radar

radar

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:

First Post!

zinclozenge

zinclozenge

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

Last Post!

radar

radar

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.

Where Next?

Popular in Discussions Top

CharlesO
Erlang :list.nth simple, but 1 - based nth(1, [H|_]) -> H; nth(N, [_|T]) when N > 1 -> nth(N - 1, T). Elixir Enum.at … coo...
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
pillaiindu
I want to convert a Phoenix LiveView CRUD website to a CRUD mobile app. What do you think is the easiest way to do so?
New
Rustixir
Hi everyone, im working on find best language/framework/system for high concurrency, high performance and stable performance after wor...
New
fireproofsocks
I’ve been working on an Elixir project that has required a lot of scripting. I usually reach for Elixir because I like it more (and in th...
New

Other popular topics Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement