What are good books on best practices of the design of domain-specific languages (DSL)?

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.

  1. On external DSLs I strongly suggest you to read the book from Markus Völter, DSL Engineering. 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.
  2. If you want to get started with one specific Language Workbench you can read the book from Lorenzo Bettini: Implementing Domain-Specific Languages with Xtext and Xtend. 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.
  3. If you are more interested in something more high-level and more focused on internal DSLs you can take a look at Domain Specific Languages 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.
  4. As an alternative, you can look to DSLs in Action (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.
  5. 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 Language Implementation Patterns 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


Domain Specific Languages

Download the guide with 68 resources on Creating Programming Languages

68resources

Receive the guide to your inbox to read it on all your devices when you have time

Powered by ConvertKit

Do You Need a Domain Specific Language (DSL)?

We can design and implement languages tailored to support your processes. We build also all the necessary infrastructure: editors, code generators, compilers, simulators. Our goal is to deliver complete solutions.

We can use different technologies like Jetbrains MPS, Xtext, and ANTLR for custom solutions.

1 reply

Trackbacks & Pingbacks

  1. […] I think that the best way to use this book for a newbie is to complement it with other books about language design or specifically on DSLs. You may want to check the list I wrote here. […]

Comments are closed.