liveBook · Manning

DSL-generic code

As explained in Building User-Friendly DSLs

Code that provides reusable implementation framework for domain-specific languages without depending on the specifics of one language.

DSL-generic code provides part of a reusable implementation framework for a domain-specific language without depending on the language’s key aspects. It remains distinct from DSL-specific code and from DSL-aspecific boilerplate. section 10.2

Its role becomes clearer through its shared implementation boundaries:

  • Supports DSL components while avoiding coupling to particular DSL concepts. section 10.2
  • Often depends on the generic low-level AST structure: plain JavaScript objects for AST objects and reference relations. section 10.2
  • Includes React component functions used by a DSL projection and shared functions in src/common/ast.js. section 10.2
  • Helps isolate DSL-specific implementation when assessing change impact and planning tests. section 10.2
Figure 10.4 Categorizing code into three kinds, and illustrating their coupling (with arrows) to the generic low-level AST structure
figure

Use the coupling diagram to distinguish DSL-generic code from DSL-specific and DSL-aspecific code around the shared AST structure. section 10.2

How Building User-Friendly DSLs covers it

How deep it goes
Defines the category, coupling boundary, and AST representation, but stops short of detailed framework implementation.
Examples
Uses React component functions and src/common/ast.js, with prescribed JavaScript objects representing AST objects and references.
What you can do after
Evaluate change impact and plan tests by isolating DSL-specific code from generic implementation structure.
How it connects
Connects DSL-specific code, DSL-aspecific code, abstract syntax trees, coupling, and DSL projections.

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.