Introduction
I have been a programmer for 19 years now and although my work is mostly around distributed, real-time and embedded systems, I've always had a fascination with compilers, interpreters and writing parsers. I remember my college days when after attending a lecture about compilers, a bunch of us thought we would take the world down with our very own programming language. That did not happen. IMHO, every software developer should go through the mental process of learning how to write a parser or how to build a compiler. The key is understanding the common patterns found across language implementations. It makes you better as a programmer!
Is Language Design Rocket Science?
As Eric Lippert once said “It is surprising to me, but lots of people do look at programming languages as magical. When I meet people at parties or whatever, if they ask me what I do, I tell them that I design programming languages and implement the compilers and tools, and it is surprising the number of times people -- professional programmers, mind you -- say "wow, I never thought about it, but yeah, someone has to design those things". It's like they thought that languages just spring up wholly formed with tool infrastructures around them already”
Languages are designed like any other product: by carefully making a series of tradeoffs amongst competing possibilities. The compilers and tools are built like any other professional software product: by breaking the problem down, writing one line of code at a time, and then testing the heck out of the resulting program.
If you're interested in designing a language, a good place to start is by thinking about what the deficiencies are in a language that you already know. Design decisions often arise from considering a design defect in another product.
I was looking out for a book about creating a programming language that was not too dense, got to the point and was free of excess jargon. I found the Create Your Own Freaking Programming Language eBook by Marc-Andre. The book did not disappoint me, and will not disappoint any programmer with interests in language applications.
Why Did I Purchase the eBook?
I purchased the eBook primarily because it was endorsed by Matz, creator of Ruby, and the same book was also used to write the popular language CoffeeScript. Good enough reasons to invest $40, which comes with a money back guarantee!
Marc does a good job explaining the different approaches of creating your own language. He starts by showing how to create a Ruby like language with Python indentation called “Awesome”, using a pure Ruby lexer, parser, and interpreter. All these tools come with the book package. The second approach is a more full featured one hosted on JVM (Java Virtual Machine) and provides an execution environment upon which you can build a higher performance language.
There’s also a 10 minute screencast which shows how to extend the JVM language. All chapters of the book have small exercises to help you practice what you learnt and being a meat-and-potatoes kind of guy, I love looking at actual code and practice it.
Who Should Read this eBook?
This eBook is good for any college student or even a professional like me trying to get a feel of how the most popular programming languages are created. It covers the important bits and the kitchen sink. However this is NOT the book on implementation details. You will need to know some concepts beforehand and be familiar with the terminology used in the book. If you are creating a compiler, a good starting point is "Let's Build a Compiler" by Jack Crenshaw.
What Does this eBook Contain?
For $39.99, you get a 60 pages eBook PDF, exercises and solution, a screencast which shows how to extend the JVM language and full source code of two languages in Ruby and Java. If I could buy a printed copy, I would lay down that stack of cash without hesitation! Well written and a hell lot of fun!