What Are Good Books on Best Practices of the Design of Domain-Specific Languages?
Domain Specific Languages are a great tool for building clean understandable code. Here we have the best resources available to help you discover best practices.
Join the DZone community and get the full member experience.Join For Free
Learn more about the advantages of moving from a monolithic to microservices architecture. Brought to you in partnership with IBM.
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.
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.
Published at DZone with permission of Federico Tomassetti, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.