3 ms·
I looked into tiny Forth and Lisp interpreters as the foundation for bootstrapping bigger things. I expected Forth to be better for this because it seems like
by jlokier 2y ago
I looked into tiny Forth and Lisp interpreters as the foundation for bootstrapping bigger things.
I expected Forth to be better for this because it seems like a smaller language, minimal even, that would have the smallest interpreter.
Forth feels lower level and simpler. After all, on the face of it, Forth is mostly a flat sequence of tokens and simple commands, run one after another liike assembly language.
Whereas Lisp has obvious tree data structures up front in a prettier syntax, like higher level languages, and you're encouraged to use them. Even lexical scope, closures and macros if you want them. That seemed like it must be bigger and heavier.
But I found the small Forth and Lisp interpreters came out about the same size.
This is backed up by the existence of 512-byte boot sector implementations of both Forth and Lisp.
So I decided for applications needing a tiny interpreter, or for bootstrapping, to not pursue Forth any more for those things, as a tiny Lisp does the job with (in my opinion) better ergonomics and versatility, and negligible cost difference.
- veltas 2y agoI'm a big Forth fan and I'd say lisp interpreters consistently come out smaller and better than their equivalent tiny Forths. I don't think it's a reason not to be interested in Forth, unless that was the draw.