Cook Computing

Continuations and VMs

April 6, 2003 Written by Charles Cook

Squawks of the Parrot also has a couple of entries on Continuations and VMs, part one and two, and why they are difficult to implement with virtual machines. Since I discovered continuations a while ago I've been playing around with Scheme a fair amount and even got as far as implementing a couple of toy Scheme interpreters. The first used the .NET CLR call stack and came to a dead end when trying to implement continuations (as Dan mentions its not possible to copy and manipulate the call stack in the .NET or Java VMs); the second was heap-based maintaining call frames, etc, as objects on the heap. My inspiration for the latter was the heap-based model described in a dissertation by Kent Dybvig called Three Implementation Models for Scheme.