MPS (Meta Programming System) is a JVM-based language workbench in the JetBrains IntelliJ/IDEA family. It creates Domain IDEs for projectional DSLs, whose languages run directly in the workbench. section 15.4.1
An MPS DSL is organized as modules containing models and named AST roots. A DSL implementation separates its concerns into aspects: structure defines the metamodel, editor defines notation, constraints and typesystem enforce rules, behavior supplies functions and Java-like logic, intentions define editor actions, and a generator defines meaning through generated code. section 15.4.2 section 15.4.2
For a business DSL, the implementation can proceed by:
- Creating a content module for DSL instances and an implementation module for the language aspects. section 15.4.2
- Defining concepts, their simple properties, containment children, and cross-reference properties in the structure aspect. section 15.4.2
- Defining projectional notation in specialized editor meta-DSLs, then adding scoping, type constraints, editor actions, behavior, and generation as needed. section 15.4.2
Car-rental DSL
A partial MPS implementation separates CarRentalCompany DSL content from BusinessDsl implementation. Its Rental root represents a record type with business rules, while record types, attributes, expressions, and types are defined as language concepts. 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.
|
Use the aspect map to navigate where an MPS language defines structure, notation, scoping, behavior, type rules, editor actions, and code generation. section 15.4.2
