Writing a Logo Interpreter
I have always wanted to understand how interpreters work. But I haven’t really succeeded in building one myself until now.
I came across an implementation of the Logo programming language by Transum and I loved it!
Looking at it’s source code I was able to understand that interpreters take some input and convert it into a structure that can be executed.
I started writing my own version of the Logo interpreter. I implemented movement and rotation commands soon enough. But I got stuck on the repeat
command.
I found a great video by The Coding Train on writing a Logo interpreter.
This was massive. It helped me understand how to implement repeat
. I studied the code and started writing my own interpreter.
My implementation is heavily inspired by both Transum and The Coding Train but it differs in two ways – there are no regular expressions and no external libraries.
After completing the interpreter, I decided to write a small book explaining how I did it. Check it out!