I have a long standing love affair with Domain Specific Languages (DSLs). Back when I was writing in C, I wrote several compilers and associated interpreters for various DSLs. This mainly involved using fairly heavyweight tools like lex
and yacc
and hand writing the virtual machines.
When I moved to Lisp, it all became much easier. Part of the Lisp culture is “building the program up” to make what is, in effect, a custom DSL that is used to implement the program logic. Recently, Nic Ferrier tweeted about a video from Rainer Joswig concerning building a simple DSL to turn file entry descriptions into objects. This is a really excellent video and I recommend it to anyone interested in Lisp and DSLs.
Before you watch the video, you should take a look at the article (from Martin Fowler) that inspired it. It will make Joswig’s presentation easier to follow. It will also help you realize how much better Lisp is at this sort of thing than C# or Java.