Building an Interpreter

I'm still figuring out what I want to do with my Blog. I know I want to tackle interesting (to me) programming challenges and re-kindle some of the joy I once had for writing code. It is also my hope that this will end up being interesting for other developers out there. We'll see.

The first thing I want to try is a series of articles focusing on the creation of an interpreter for a little language.

A Little Background

I've always been a bit in awe of compiler and interpreter technology.

Wait... you're telling me all I have to do is write some text, format it a bit, use some keywords judiciously then feed it to this other program and, like magic, the computer does what I tell it to do? (Ok, it does what I tell it to do after the sixteenth time of trying and fixing errors. Happy?)

Amazing. How can that work? I just wrote text and the CPU only deals with 1's and 0's. What is happening behind the scenes? It is the same kind of tickle in my brain that I felt when I first discovered that I wanted to be a coder. (A story for another time.)

Over the years I have studied a bit about how programming languages work. I get the basics, but I've never sat down and really worked on anything real and as Hal Abelson says in the Forward to Essentials of Programming Languages:

If you don't understand interpreters, you can still write programs; you can even be a competent programmer. But you can't be a master.

The Plan

I'll be using the book I mentioned above for this trip into interpreter land. It uses Scheme for its code examples, but I will be working in Ruby. I have a feeling that converting Scheme concepts into Ruby code will give me a peek at some of the lesser known corners of Ruby.

I hope to get something meaningful to show about once a week, but I'll be juggling this along with work and other responsibilities so there might be some lag.

I'm not 100% sure I will be able to get entirely through this project. Every other time I have tried to dig into an interesting project like this life came along and swept me off course. It sounds like a lot of fun though, so I'm going to do my best to keep the my hand on the rudder.