Domain-specific languages (DSLs) are increasingly used as embedded languages within general-purpose host languages. DSLs provide a compact, dedicated syntax for specifying parts of an application related to specialized domains. Unfortunately, such language extensions typically do not integrate well with existing development tools. Editors, compilers and debuggers are either unaware of the extensions, or must be adapted at a non-trivial cost. Furthermore, these embedded languages typically conflict with the grammar of the host language and make it difficult to write hybrid code; few mechanisms exist to control the scope and usage of multiple tightly interconnected embedded languages. In this dissertation we present Helvetia, a novel approach to embed languages into an existing host language by leveraging the underlying representation of the host language used by these tools. We introduce Language Boxes, an approach that offers a simple, modular mechanism to encapsulate (i) compositional changes to the host language, (ii) transformations to address various concerns such as compilation and syntax highlighting, and (iii) scoping rules to control visibility of fine-grained language changes. We describe the design and implementation of Helvetia and Language Boxes, discuss the required infrastructure of a host language enabling language embedding, and validate our approach by case studies that demonstrate different ways to extend or adapt the host language syntax and semantics.
24. Thesis
To support seamless integration of context-dependent
languages without breaking the tools, we need
1. a host-language grammar that can be changed by
language extensions,
2. a first-class language description used by the
development environment, and
3. a transformation mechanism of the embedded language
into a common executable representation.
24
123. Language Boxes
Host Language
Dynamic
Grammars
Language and Tool Extensions
123
To support seamless integration of context-dependent
languages without breaking the tools, we need
1. a host-language grammar that can be changed by
language extensions,
2. a first-class language description used by the
development environment, and
3. a transformation mechanism of the embedded
language into a common executable representation.
124. Language Boxes
Host Language
Dynamic
Grammars
Language and Tool Extensions
124
To support seamless integration of context-dependent
languages without breaking the tools, we need
1. a host-language grammar that can be changed by
language extensions,
2. a first-class language description used by the
development environment, and
3. a transformation mechanism of the embedded
language into a common executable representation.
125. Language Boxes
Host Language
Dynamic
Grammars
Language and Tool Extensions
125
To support seamless integration of context-dependent
languages without breaking the tools, we need
1. a host-language grammar that can be changed by
language extensions,
2. a first-class language description used by the
development environment, and
3. a transformation mechanism of the embedded
language into a common executable representation.
126. Language Boxes
Host Language
Dynamic
Grammars
Language and Tool Extensions
126
To support seamless integration of context-dependent
languages without breaking the tools, we need
1. a host-language grammar that can be changed by
language extensions,
2. a first-class language description used by the
development environment, and
3. a transformation mechanism of the embedded
language into a common executable representation.