3 ms·
There's also Make-A-Lisp and, unlike most write-you-a-lisp/scheme-s out there, that one also covers TCO interpretation, quasiquotation/unquote for macros and th
by dualogy 2y ago
There's also Make-A-Lisp and, unlike most write-you-a-lisp/scheme-s out there, that one also covers TCO interpretation, quasiquotation/unquote for macros and their expansion, and goes up to self-hosting: https://github.com/kanaka/mal/ https://github.com/kanaka/mal/
I just went through it over 2-3 days, great practice IMHO to do once in your life from start to finish: https://github.com/metaleap/go-lisp https://github.com/metaleap/go-lisp
- KineticLensman 2y agoConcur, although it took me two to three months, not days (was working full time is my excuse). Biggest grief point was getting macro expansion to work correctly; TCO worked almost first time, IIRC.
- codr7 2y agoUnquoting took me several implementations to wrap my head around and consistently get good enough. As did register allocation, which is more of a VM issue.
- KineticLensman 2y agoInteresting. I'm about to start doing a MAL-like again, but this time (I used C# before) using Rust and building a VM as in Crafting Interpreters rather than following the MAL guide. Macros are one of the things that I anticipate being a challenge.
- dualogy 2y agoAFAICT, their expansion still happens during an interpretation cycle — but when you "interpret" AST into your byte-code.
- codr7 2y agoOr compile, since it's usually a transformation. I like to call that the emit phase, as in emitting byte code. The interesting thing is that it only happens once, before the code is evaluated.