liveBook · Manning

DSL structure

As explained in Building User-Friendly DSLs

The organization and rules of a domain-specific language that define its concepts, properties, types, instances, relations, and permitted compositions.

DSL structure is the fixed organization that makes domain-specific language content understandable to domain experts and processable by software. It defines concepts, their properties and types, the instances created from those concepts, and the relations represented by property settings. section 1.4.2 section 1.5

A DSL’s structure is built from these elements:

  • Concepts provide blueprints for fundamental constructs and have names. section 1.4.2
  • Properties belong to concepts, have names and types, and determine what values can be stored. section 1.4.2
  • Instances realize concepts in DSL content, while settings assign values to their properties. section 1.5
  • Relations connect instances through settings, with property types governing which connections are allowed. section 1.4.2

Car-rental language

A business rule instance uses condition and consequence properties, signaled by “If the” and “then.” A record type instance groups a name and attributes, while an attribute instance defines a name, type, and optional initial value. A record type can hold attribute instances through its attributes property. section 1.4.2

Changing structure means adding, removing, renaming, or retargeting concepts and properties, or refactoring several together. Adding a property or concept widens the accepted AST structure; incompatible changes require AST migration, often implemented as a depth-first traversal. section 10.3.2 section 10.4

Figure 1.20 Zooming in on the structure aspect of a DSL
figure

Use the structural overview to trace how concepts, properties, types, instances, settings, and relations fit together. section 1.4.2

How Building User-Friendly DSLs covers it

How deep it goes
Explains concepts, properties, types, instances, settings, relations, structural refactorings, and AST migration, but defers implementation detail for most constructs.
Examples
Uses car-rental business rules, record types, attributes, property settings, and a Data Attribute-to-Attribute AST migration.
What you can do after
Evaluate DSL content and structural changes by tracing allowed values, instance relations, AST conformance, and required migrations.
How it connects
Connects DSL notation, DSL constraints, instances, properties, relations, ASTs, AST migration, Domain IDEs, and code generation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building User-Friendly DSLs. The section links point to the parts of the book it draws on.