wingo posts a meta-circular evaluator for Guile. I've not time now, but I want to take a closer look at the code.
I have two thoughts about eval for guile:
- It can be good to write the target scheme in such a way that it can allocate all of its closures on the stack, as scheme48->prescheme does. This is a nontrivial transformation, but it means that (i) you don't need to worry about TCO, since tail calls are achieved by popping the stack, and so (ii) you can use pretty, dimwitted ceval-like code without trouble, and (iii) it's a stretch to call this an interpreter, but since you only need source-to-source transformation, it's higher level than what we usually mean by compilation. Dan Friedman has written up some relevant stuff on the transformations needed to do this.
- More generally, is there any interest in rearchitecting the elisp bytecode so that it fits the Guile VM?
