O'Reilly logo

Domain Specific Languages by Martin Fowler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required