continuations in a tiny concatenative language

stevan apter — 2003-08-17 18:56:43

i've implemented a tiny concatenative language which contains first-
class continuations. so far, i've been able to simulate exceptions
and control structures like 'do' and 'while'. and recursion doesn't
run up against the c stack. i've written it up at

http://www.nsl.com/papers/continuations.htm

and the code is at

http://www.nsl.com/k/tck.k

i haven't figured out how to do co-routines yet. maybe someone here
has an idea.

as in the unlambda interpreter, russ's approach to O(1) joy gave me
the key (pass the result stack and the input stack to all programs,
modify one or both as needed.)