Writing an interpreter in Go (Elixir version)

Recently I’ve been reading Writing an interpreter in Go, but have been writing the code in Elixir instead, because I prefer Elixir’s syntax to Go’s.

I’d thought I share it here because others might be interested in what such a thing could look like in Elixir – although my code isn’t “perfect”. I’ve also been cribbing bits from a more complete implementation by fabrik42 too. But I’ve been trying to figure stuff out myself first.

I can imagine that you could possibly adapt this to things like writing a Markdown interpreter / parser too.

I don’t know how far I’ll get through the book, but it has been an interesting exercise so far to see how the code between the two languages translates, as well as it being my first time building anything like this. I usually spend my time in web-app land.

Anyway, thought it would be of interest to the forum :slight_smile:

8 Likes

Nice, I was thinking of doing the same in Rust. How do you like the book?

The book has explained things pretty well so far in the 40 or so pages that I’ve read. He has a conversational writing style that I can appreciate. He writes some code and then explains what it all does.