Comment by matheusmoreira
Comment by matheusmoreira a day ago
> Has anyone else built something similar?
I made my own lisp. It used to have a recursive interpreter but I recently finished converting it into a register/stack machine that's essentially a modified version of the Explicit Control Evaluator from Structure and Interpretation of Computer Programs.
https://github.com/lone-lang/lone/blob/master/source/lone/li...
Now I'm thinking about converting it into a CESK machine which I believe is a proper stack machine. Modifying the SICP machine has proven difficult due to the loose stack discipline. I'm told register machines are faster but keeping track of all those ad hoc pushes and pops is turning into a nightmare.
> What features would you add to make it more useful?
The neat part about all these machines is how the stack itself turns into some sort of code. You push some state indicating what you want the machine to do next. Then you set it up so that it evaluates a value. When it's done, that value just flows into whatever the next computation step is.
Making a copy of the stack and wrapping it into a callable that just plugs that value in is how first class continuations are implemented.