liveBook · Manning

DSL-specific code

As explained in Building User-Friendly DSLs

Code that is strongly dependent on one or more defining aspects of a particular domain-specific language.

DSL-specific code is code that depends strongly on defining aspects of a particular domain-specific language. It commonly implements the language’s meaning or relies on its structural representation. section 10.2

Typical roles and boundaries include:

  • The src/language directory intentionally contains DSL-specific constraints-checking and query functions used by both the frontend and code generator. section 10.2
  • Generator code can be specific to the DSL’s meaning, while query functions can be coupled to its structural aspects. section 10.2
  • Generated code is strongly coupled to both the DSL content that produced it and the code generator that produced it. section 10.2
  • Classifying files alongside DSL-generic AST utilities and DSL-aspecific convenience code exposes architectural boundaries and coupling. section 10.2
Figure 10.9 A chart of coupling between the DSL’s key aspects and the DSL-specific parts of components
figure

Use the coupling chart to compare DSL aspects with the DSL-specific parts of surrounding components. section 10.2

How Building User-Friendly DSLs covers it

How deep it goes
Distinguishes specific, generic, and aspecific code, then charts coupling across the IDE, runtime, and generator.
Examples
Uses src/language constraints and queries, generator templates, serialized DSL content, and a file-classification exercise.
What you can do after
Evaluate a DSL-based codebase by classifying files and identifying coupling between language aspects and components.
How it connects
Connects DSL-specific code with abstract syntax trees, code generators, generated code, runtime systems, and coupling.

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.