A meta-DSL is a DSL used to specify another DSL, or particular aspects of one. Its domain is software-language specification: for example, a metamodel DSL can define the structure of DSL content. section 15.3
An explicit metamodel needs notation, which makes a meta-DSL useful when DSL structure should be specified strictly. That strictness can complicate a deliberately lenient AST, so it is not automatically worthwhile for a small, evolving DSL. section 15.3
Language workbenches commonly provide several specialized meta-DSLs rather than one general notation. Together they can specify structure, constraints, editors, type systems, behavior, and code generation for a DSL. section 15.4.1 section 15.4.2
Table 15.1 Aspects of a DSL implementation in MPS, with description and mapping to a key aspect from chapter 1 (where that exists)
|
MPS aspect name
|
Key aspect (ch. 1)
|
Role
|
|---|---|---|
structure
|
Structure
|
As in chapter 1.
|
editor
|
Notation
|
As in chapter 1.
|
constraints
|
n/a
|
Specifies to which reference properties
scoping should be applied. (The MPS name is a bit misleading.)
|
behavior
|
n/a
|
Defines functions on concepts (among others implementing scoping) and “almost-ordinary” Java classes. MPS provides BaseLanguage, a variant of Java, to implement behavior and code logic within other meta-DSLs.
|
typesystem
|
(Part of constraints)
|
Defines a type system and implements all constraints. (Again, the MPS name is a bit misleading.)
|
intentions
|
n/a
|
Defines editor actions.
|
generator/BusinessDsl/ main
|
Meaning
|
Defines a
main code generator for the
BusinessDsl.
|
MPS separates a DSL implementation into aspects. The table maps its structure, editor, constraints, behavior, typesystem, intentions, and generator aspects to their roles. section 15.4.2
Defining a car-rental DSL in MPS
An MPS implementation places DSL content in a CarRentalCompany module and implementation aspects in a BusinessDsl module. Its structure aspect explicitly defines concepts such as Record Type, Attribute, and Type; editor definitions specify their notation. section 15.4.2
