Chapter 26. Embedded Interpretation

Embed interpreter actions into the grammar, so that executing the parser causes the text to be directly interpreted to produce the response.


There are many occasions where you may want to run a DSL script and get an immediate result, such as performing a calculation or running a query. Embedded Interpretation interprets the DSL script during parsing, so the result of the parse is the result of the script itself.

26.1 How It Works

Embedded Interpretation works by evaluating DSL expressions as soon as possible, collating results together, and returning the overall result. Embedded Interpretation does not use ...

Get Domain Specific Languages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.