Most hackers can spend their whole careers creating amazing software without ever needing to write a compiler or design a programming language. Like many professions, a lot of useful work can be accomplished with the established tools, rather than focusing efforts on the invention and craft of the tools themselves. Most carpenters purchase their tools at a hardware store. I’d probably raise an eyebrow if my doctor tried to measure my blood pressure with something she cobbled together in the garage (on second thought, that’d be pretty cool).
Unlike most other professions, however, the software developer has a unique advantage: the tools of the trade are made using the trade itself. A compiler is software that builds other software. I think that’s what intrigues programmers and simultaneously scares them away from language and compiler design. It’s magic.
Joel Pobar exposes a bit of this mystery in an introduction to compiler design for MSDN Magazine:
Compiler hackers are celebrities in the world of computer science. I’ve seen Anders Hejlsberg deliver a presentation at the Professional Developers Conference and then walk off stage to a herd of men and women asking him to sign books and pose for photographs. There’s a certain intellectual mystique about individuals who dedicate their time to learning and understanding the ins and outs of lambda expressions, type systems, and assembly languages.
The article is a walkthrough on the creation of a simple programming language and a corresponding compiler that targets the .NET CLR virtual machine. It’s a nice introduction to compiler design, and you can download the C# source for the sample compiler that’s discussed. Perhaps this will be the starting point for the creation of your own programming language.
ADVERTISEMENT