11 research outputs found
Towards Reuse on the Meta-Level
Modern software development peaks in complex product lines and utilizes features of programming languages to their extend. On the other hand, model driven development shines by abstraction from implementation details to ease communication between programmers and domain experts. With the CINCO meta tooling suite there is now a framework to factor out programming knowledge completely in that it allows creating domain specific graphical modeling environments. Bundled with capabilities of full code generation domain experts can create software with minimum effort. In this paper an extension to the language family of CINCO is introduced which acts as one part of a foundation for developing software product lines. It highly stretches reuse of model specifications to overcome reoccurring problems in the context of inter-model references
Revisiting visitors for modular extension of executable DSMLs
Executable Domain-Specific Modeling Languages (xDSMLs) are typically defined by metamodels that specify their abstract syntax, and model interpreters or compilers that define their execution semantics. To face the proliferation of xDSMLs in many domains, it is important to provide language engineering facilities for opportunistic reuse, extension, and customization of existing xDSMLs to ease the definition of new ones. Current approaches to language reuse either require to anticipate reuse, make use of advanced features that are not widely available in programming languages, or are not directly applicable to metamodel-based xDSMLs. In this paper, we propose a new language implementation pattern, named Revisitor, that enables independent extensibility of the syntax and semantics of metamodel-based xDSMLs with incremental compilation and without anticipation. We seamlessly implement our approach alongside the compilation chain of the Eclipse Modeling Framework, thereby demonstrating that it is directly and broadly applicable in various modeling environments. We show how it can be employed to incrementally extend both the syntax and semantics of the fUML language without requiring anticipation or re-compilation of existing code, and with acceptable performance penalty compared to classical handmade visitors
Covariant Conversions (CoCo): A Design Pattern for Type-Safe Modular Software Evolution in Object-Oriented Systems
Software evolution is an essential challenge for all software engineers, typically addressed solely using code versioning systems and language-specific code analysis tools. Most versioning systems view the evolution of a system as a directed acyclic graph of steps, with independent branches that could be merged. What these systems fail to provide is the ability to ensure stable APIs or that each subsequent evolution represents a cohesive extension yielding a valid system. Modular software evolution ensures that APIs remain stable, which is achieved by ensuring that only additional methods, fields, and data types are added, while treating existing modules through blackbox interfaces. Even with these restrictions, it must be possible to add new variations, fields, and methods without extensive duplication of prior module code. In contrast to most literature, our focus is on ensuring modular software evolution using mainstream object-oriented programming languages, instead of resorting to novel language extensions. We present a novel CoCo design pattern that supports type-safe covariantly overridden convert methods to transform earlier data type instances into their newest evolutionary representation to access operations that had been added later. CoCo supports both binary methods and producer methods. We validate and contrast our approach using a well-known compiler construction case study that other researchers have also investigated for modular evolution. Our resulting implementation relies on less boilerplate code, is completely type-safe, and allows clients to use normal object-oriented calling conventions. We also compare CoCo with existing approaches to the Expression Problem. We conclude by discussing how CoCo could change the direction of currently proposed Java language extensions to support closed-world assumptions about data types, as borrowed from functional programming
The Essence of Nested Composition
Calculi with disjoint intersection types support an introduction form for intersections called the merge operator, while retaining a coherent semantics. Disjoint intersections types have great potential to serve as a foundation for powerful, flexible and yet type-safe and easy to reason OO languages. This paper shows how to significantly increase the expressive power of disjoint intersection types by adding support for nested subtyping and composition, which enables simple forms of family polymorphism to be expressed in the calculus. The extension with nested subtyping and composition is challenging, for two different reasons. Firstly, the subtyping relation that supports these features is non-trivial, especially when it comes to obtaining an algorithmic version. Secondly, the syntactic method used to prove coherence for previous calculi with disjoint intersection types is too inflexible, making it hard to extend those calculi with new features (such as nested subtyping). We show how to address the first problem by adapting and extending the Barendregt, Coppo and Dezani (BCD) subtyping rules for intersections with records and coercions. A sound and complete algorithmic system is obtained by using an approach inspired by Pierce\u27s work. To address the second problem we replace the syntactic method to prove coherence, by a semantic proof method based on logical relations. Our work has been fully formalized in Coq, and we have an implementation of our calculus
Constructing Hybrid Incremental Compilers for Cross-Module Extensibility with an Internal Build System
Context: Compilation time is an important factor in the adaptability of a
software project. Fast recompilation enables cheap experimentation with changes
to a project, as those changes can be tested quickly. Separate and incremental
compilation has been a topic of interest for a long time to facilitate fast
recompilation.
Inquiry: Despite the benefits of an incremental compiler, such compilers are
usually not the default. This is because incrementalization requires
cross-cutting, complicated, and error-prone techniques such as dependency
tracking, caching, cache invalidation, and change detection. Especially in
compilers for languages with cross-module definitions and integration,
correctly and efficiently implementing an incremental compiler can be a
challenge. Retrofitting incrementality into a compiler is even harder. We
address this problem by developing a compiler design approach that reuses parts
of an existing non-incremental compiler to lower the cost of building an
incremental compiler. It also gives an intuition into compiling
difficult-to-incrementalize language features through staging.
Approach: We use the compiler design approach presented in this paper to
develop an incremental compiler for the Stratego term-rewriting language. This
language has a set of features that at first glance look incompatible with
incremental compilation. Therefore, we treat Stratego as our critical case to
demonstrate the approach on. We show how this approach decomposes the original
compiler and has a solution to compile Stratego incrementally. The key idea on
which we build our incremental compiler is to internally use an incremental
build system to wire together the components we extract from the original
compiler.
Knowledge: The resulting compiler is already in use as a replacement of the
original whole-program compiler. We find that the incremental build system
inside the compiler is a crucial component of our approach. This allows a
compiler writer to think in multiple steps of compilation, and combine that
into a incremental compiler almost effortlessly. Normally, separate compilation
\`a la C is facilitated by an external build system, where the programmer is
responsible for managing dependencies between files. We reuse an existing sound
and optimal incremental build system, and integrate its dependency tracking
into the compiler.
Grounding: The incremental compiler for Stratego is available as an artefact
along with this article. We evaluate it on a large Stratego project to test its
performance. The benchmark replays edits to the Stratego project from version
control. These benchmarks are part of the artefact, packaged as a virtual
machine image for easy reproducibility.
Importance: Although we demonstrate our design approach on the Stratego
programming language, we also describe it generally throughout this paper. Many
currently used programming languages have a compiler that is much slower than
necessary. Our design provides an approach to change this, by reusing an
existing compiler and making it incremental within a reasonable amount of time