612 B
612 B
Hydra; a multi-headed Python-on-Python interpreter.
Hydra draws extensively the OCaml and Scheme prior art for coroutine based interpreters to produce a Python interpreter along the same lines.
At the top of the interpreter we see an extensible while
loop. The interpreter
performs one "step" - evaluating a single statement - producing a new state and
a "next PC"; a path into the AST identifying the next statement to be executed.
This model enables single stepping, stack analysis and most importantly interruptions as for snapshotting or suspending.
Hydra is the basis for the Flowmetal interpreter.