Recently I answered this question on quora. I thought it could be useful to report the answer here, in case someone else is looking for books about Domain Specific Languages.
What are good books on best practices of the design of domain-specific languages (DSL)?
On one side you have internal DSLs: they are sort of fluent interfaces written typically in flexible languages like Ruby. You create functions, classes and metaprogramming tricks to let the programmer specify the logic in something that resembles a specific language but is actually just regular code (Ruby for example).
Then you have external DSLs: they are regular languages with their tooling. You can have parsers, editors, code generators or interpreters and other stuff.
External DSLs are the real stuff, internal DSLs are nice but really nothing game changing.
- On external DSLs I strongly suggest you to read the book from Markus Völter, . Markus is a very well known consultant doing real stuff. This is a book about external DSLs, with practical pieces of advice, comparing several language workbenches. He talks about very different approaches to DSLs and he has unique hands-on experience. Simply put, he is probably the best world expert on DSLs.
- If you want to get started with one specific Language Workbench you can read the book from Lorenzo Bettini: . It will teach you how to write DSLs using Xtext. Xtext is a mature Language Workbench for writing textual DSLs. It is a very reasonable choice and when you have finished this book you will have some real competence in writing DSLs.
- If you are more interested in something more high-level and more focused on internal DSLs you can take a look at from Martin Fowler. He is a well-known opinion leader and a great speaker, so it could make sense to listen to what he has to say.
- As an alternative, you can look to (I was one of the technical reviewer for this book). It is nice to read but also this one is focused mostly on internal DSLs.
- If you are not interested in building great editors for your language or you want to have a fully customized solution for your textual language you can consider looking into ANTLR. It is “just” a parser generator, so it does not provide full tool support like Xtext or MPS but it is a well-known tool and the book describe how to use it in practice. The author introduces patterns which are useful in general.
You could be interested in The complete guide to Domain Specific Languages.
There we discuss all sort of examples, resources, tools to build DSLs and more
Download the guide with 68 resources on Creating Programming Languages
Receive the guide to your inbox to read it on all your devices when you have time