4 ms·
Lisp dramatically lowers the bar to make a compiler. You don't have to mess with parser generators and do complicated parsing, the Lisp reader and s-expressions
by Hexstream 17y ago
Lisp dramatically lowers the bar to make a compiler. You don't have to mess with parser generators and do complicated parsing, the Lisp reader and s-expressions already provide a ridiculously simple and powerful framework to make your own syntax and semantics.
You can easily invent your own language, basically you can just represent the structures of your language as objects and then walk that structure to generate a tree of closures that represent the semantics, the code to execute. With a compiler, you can give your language very "special" semantics and performance isn't adversely affected (it might in fact be better). What's more, if your custom language is very declarative, really close to what you actually mean to say, your "programs" written in that language is actually useful data you can use to make high-level debuggers and such.
And for generating that tree of objects in the first place, you can use macros to make a nice s-expression representation that expands into object instantiations instead of having to do objects manually, which is harder to both read and write.
If you try this, you'll see that languages really are not that magical, that it's within your reach to design and implement one even without investing hundreds of hours in learning arcane skills, if you use the right tools.