[ANN] MonkeyLang.jl

Just implemented Writing an Interpreter in GO in Julia.

I think I have learned quite a lot during this process, and I would like to share my project MonkeyLang.jl with the community.

17 Likes

Question : have you implemented (if not, will you implement) macros? cf. The Lost Chapter.

And, what is your feeling about how it compares with other (Go? Rust? …) implementations (eg. facility of writing, execution speed, …).

Just curiosity, no need to do anything. Thanks for the work and the sharing!

2 Likes

The Lost Chapter is definitely on my schedule, but I have not started yet.

I have not done any benchmarking. But there are a few points I would like to mention:

  • Julia’s multiple dispatches work like a charm when it comes to evaluating AST nodes.
  • With Julia’s abstract type graph, I do not need to implement dummy methods (to distinguish expressions with statements) as the GO version does.
  • The implementation of Hash is greatly simplified compared to the GO version, since Julia’s native hash() function works well in all cases I have met till now.
3 Likes

By the way, CoPilot worked surprisingly during the whole process. I think it must have learned a lot from other implementations of “Writing an Interpreter in GO”, since it yielded the exact test cases even before I typed them in.

2 Likes

I am proud to say that I have finished the Lost Chapter. After implementing it, I am much more confident to dig deeper into Julia’s macro system now.

2 Likes

Bravo for the speed for completing the Chapter!

1 Like