A Cheat Sheet

How do I separate parsing logic from semantic logic (from code generation logic)?

=> Semantic Model

I’m using an internal DSL => Expression Builder + Semantic Model

Parsing

How do I hold symbols to cross-reference between different parts of the parse?

=> Symbol Table

How do I keep hierarchic context during the parse?

As much as possible, I keep it on the stack and use parameters and return values.

If I can’t => Context Variable

How do I gradually build up an immutable object?

=> Construction Builder

How do I collect and return multiple errors back to the caller of the parse?

=> Notification

External DSLs

How do I break up text into a parsing structure?

=> Syntax-Directed Translation + BNF

My structure is very simple => Delimiter-Directed ...

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.