Code Generation and DSLs in Scheme

Over the years, I have heard some pretty outrageous and tantalizing claims made about the programming language Lisp. For example, “It will change you, forever.” and “You write code that writes code.”. Sadly, no further explanation is ever provided. Perhaps it is impossible to capture the essence of that to which these statements allude? This air of mystery around Lisp is both a blessing and a curse. Some folks will find this aura repugnant; others magical. For me, it was the latter. I wanted in on the secret!

When it comes to learning about new ideas, there is simply nothing more helpful than both great books and talking to folks knowledgeable on the topic. So, TSPL, SICP, TLS, along with the wonderful folks in both comp.lang.scheme and the PLT discussion list, have really made this effort a lot of fun.
To capture the fruits of my labor, both for myself and for any folks interested in the same topic, I prepared a presentation on code generation and DSLs in Scheme. The presentation itself is driven by a popular Martin Fowler article on the topic of programming language tools entitled “Language Workbenches: The Killer-App for Domain Specific Languages?”. The presentation is written for folks familiar with object oriented programming, my hope being that familiar territory would ease the introduction of the topic. While *numerous* code samples in Scheme are provided both in the presentation itself and in the supplementary archive, you should feel free to skip them; they are included only for folks who wish to delve further into learning Scheme. If you would like to run them, please use DrScheme v371 and set the language level to “Pretty Big”.
Code Generation and DSLs in Scheme: The presentation
Code Generation and DSLs in Scheme: The code
Enjoy!
Addendum: 8/2/8
When I wrote this presentation, I was just beginning to scratch the surface of macros in Scheme. There is way, way too much code in it. Reflecting back on this, I see that teaching is a lot different than shoving a lot of information down someone’s throat. I will keep this here, though, for historical reference, and for anyone else who may benefit from this content.

Leave a Reply

Your email address will not be published. Required fields are marked *