Monkey Business
I’ve written my first programming language interpreter! Monkey is a programming language described in the excellent books Writing An Interpreter In Go and Writing A Compiler In Go, by Thorsten Ball.
Over the past few weeks, I went through the first of these books (Writing An Interpreter In Go) and wrote an interpreter for the Monkey language in the Swift programming language. Here’s the GitHub repo: https://github.com/umairsd/swift-monkey-interpreter. Check it out, and let me know what you think. Please share any feedback!
Writing An Interpreter In Go is a brilliant book. It has been on my reading list for a couple of years, and I regret not going through it sooner. The book walks the reader through the ideas behind building an interpreter step-by-step, with fully functional code (in Go) and tests. I particularly appreciated the test-driven nature and tried to follow it very closely in my implementation as well.
Now that I’ve written the interpreter, I can’t wait to start building the compiler by following Thorsten’s second book.