I am currently working on an interpreter written in C, with the intention that it should support continuations and call/cc. I am doing this with continuation-machine semantics, which means small-step evaluation. In the process of figuring out how continuations interact with environments, I think I've discovered that my small-step evaluator in SML
(
Read more... )
Comments 7
Reply
Man, this project is great for reinventing the last 30 years of PL research in 30 days :D you've already knocked out at least three of the classics; for your next trick, you should invent domain theory!
Reply
I'm also not restricting myself to a strict rewrite-rule semantics: I'm only going to bother capturing the state of execution right before function application, since that's the only place the continuation can be captured. Between function applications I'm freely doing as much work as I can.
Reply
Reply
Reply
Reply
Currently my continuation datatype saves an interpreter-structure (specific to the particular special form being interpreted) and a pointer down the stack to the next continuation. I think it's a good point that, to follow the C analogy, I should just stick an environment pointer in there as well. Probably what I actually need, by close analogy with C (and based on my comments about what I broke in the SML version) is to have a saved-environment pointer only in the function-application continuation-frames.
Reply
Leave a comment