liveBook · Manning

Concrete syntax

As explained in Building User-Friendly DSLs

The notation-level form of language content, including its textual and visual presentation details.

Concrete syntax is the notation of a domain-specific language (DSL): the textual or visual form in which its content is presented. Its details may include keywords, symbols, indentation, boxes, arrows, and other visual markers. section 2.2 section 2.3

Extracting visual cues from concrete syntax reduces notated content to structured data called abstract syntax. An object-relation diagram (ORD) can represent that structure, and disregarding reference relations allows it to become an abstract syntax tree (AST). section 2.2 section 2.3

Read concrete syntax by identifying the cues that carry structure:

  • Recognize the whole construct, such as a record type and its name. section 2.2
  • Use keywords, symbols, indentation, boxes, and arrows to find contained elements and relationships. section 2.2
  • Represent names, types, numbers, and references as properties or relations in structured data. section 2.2

Rental record type

A concrete DSL description defines a Rental record type with four indented attributes. Extraction first represents the record type, then adds its name, attribute objects, containment relations, attribute names and types, numeric initial values, and reference values. section 2.2

Figure 2.8 The DSL content defining the Rental record type
figure

Inspect the notated Rental record type that supplies the concrete syntax for the extraction example. section 2.2

How Building User-Friendly DSLs covers it

How deep it goes
Defines concrete syntax and works through visual-cue extraction, while deferring reconstruction from ASTs to later treatment.
Examples
Uses a Rental record type with indented attributes, property values, numeric initial values, and reference values.
What you can do after
Apply visual-cue extraction to reduce notated DSL content into structured data represented by an ORD or AST.
How it connects
Connects concrete syntax to abstract syntax, object-relation diagrams, abstract syntax trees, and DSL editors.

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.