Hacker News new | past | comments | ask | show | jobs | submit login
Mal – Make a Lisp, implemented in 79 languages (github.com)
217 points by tony-allan 5 days ago | hide | past | web | favorite | 11 comments





Mal is absolutely great. I implemented it a couple of month ago (all tests pass while self hosting) in go. There was already an implementation in go, but I did it for the learning experience. Got more comfortable with go. I feel like lisp makes a lot more sense to me now. And I have a basic understanding of how to go about writing an interpreter/compiler.

The documentation in my opinion is fantastic, because I could jump in and start implementing it without feeling like I was just translating prose and diagrams to code (need to actually understand what you're implementing), or ever feeling completely lost. The end product still feels like 'my' interpreter.

If you'd like to learn more about lisp and interpreters/compilers, or just get more familiar with a language to implement it in: I can absolutely fully recommend implementing mal.

Edit: Oh, and if you do implement it yourself. Don't look at existing code. If I wasn't sure on the exact expected behavior at any point, I used the online JS implementation of mal as a black-box to see how it behaves: https://kanaka.github.io/mal/


Thanks for the tip about the online implementations. As you suggest a great resource while you're doing your own implementation.

This looks like an awesome resource for learning new languages and also for understanding Lisp at a more fundamental level. I'm going to share this with my students next semester when I teach PL.

Are there any other projects like this that let you compare implementations using many different languages (e.g., Rosetta Code)?


It does remind me of the Real World repository [0]. It is basically a Medium clone implemented in tons of different frontend and backend frameworks. Probably not exactly what you were looking for, since it's more related to the frameworks rather than the programming languages, but it is still interesting nonetheless.

[0] https://github.com/gothinkster/realworld


The Lox Language is another teaching tool by Bob Nystrom with many implementations [1] and a great (work in progress) book [2]

[1] https://github.com/munificent/craftinginterpreters/wiki/Lox-...

[2] http://craftinginterpreters.com/


Not exactly what you're looking for, but: https://github.com/mame/quine-relay

I made it ~60% of the way through this and thought it was really well done. The guide gives detailed instructions so you never feel stuck, but because it's language-agnostic you still have to translate everything into specific code which forces real understanding (can't just copy-paste code snippets).

The TempleOS version of Mal includes the optional GC. It's written in HolyC and might be one of the few semi serious programs written for the OS.

I started my Mal implementation almost exactly one year ago as a winter project after it was previously discussed on HN. I finished it four months later [0], with a great sense of achievement (I hadn’t programmed anything so complex for more than 20 years).

Unlike many of the Linux-based implementations I used C# in Visual Studio, and I never managed to get the automated test-suite to work. I tried very hard not to cheat but did have to refer to the reference C# implementation a couple of times. The implementation of macros was the hardest part, not helped by a month where I got almost no coding done and a couple of silly errors in an earlier step (which one of the tests I’d missed would have uncovered). I made what I thought were a couple of improvements to the base language, including better error handling, multi-line forms and multi-form lines.

For this winter’s project, I’m going to see if I can take source code for the original Elisa chatbot and re-implement it in MAL. I’m also tempted to see if I can build a simple IDE for MAL.

[0] https://www.non-kinetic-effects.co.uk/blog/2019/04/28/MAL-5



Joel Martin first presented about Mal in 2014 and his presentation was written in Mal. Awesome!

https://github.com/kanaka/mal/blob/master/examples/clojurewe...




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: