3 ms·
Lisps, can be, and sometimes are, implemented in a similar way. Trying to figure out the exact number of Lisp primitives required to write the rest of Lisp in
by retrac 4y ago
Lisps, can be, and sometimes are, implemented in a similar way. Trying to figure out the exact number of Lisp primitives required to write the rest of Lisp in Lisp is seemingly a hobby for some. A compiler for a functional language usually transforms the program into another functional language, an intermediate representation, one much more friendly to machine-implementation. (The classic model has four pointers to four lists and has simple operations for the items in those lists, and that's about it.)
It's a relatively small leap to writing the language in that subset, and implementing a small virtual machine for that subset, and then executing the language. Many toy Scheme implementations have been written in this way. But most major implementations, while often written in Lisp (or Scheme), generally do not do that. They use the full language and are not able to bootstrap like that. Though the 1980s Lisp machines kind of did do it that way. The garbage collector and parts of the OS and runtime were written in a Lisp-like assembly language.
- alexisread 4y agohttps://github.com/udem-dlteam/ribbit https://github.com/udem-dlteam/ribbit And https://piumarta.com/software/maru/ https://piumarta.com/software/maru/ Are two good examples. Maru is interesting in that it can implement a full-fat language/os/vm/compiler in under 2kloc Bluebottle is another barbecues and up OS: https://github.com/btreut/a2 https://github.com/btreut/a2