pub enum Mode {
Eval {
env: Env,
exp: RcExp,
},
Apply {
val: Val,
},
}Expand description
The CK machine alternates between two modes:
-
Eval: we have anExpto evaluate underEnv. The dispatcherstep_evalinspects theExpand either produces aValimmediately (literals, vars, lambdas) or pushes aContand switches to evaluating a sub-expression. -
Apply: we have a finishedVal. The dispatcher pops the topmostContfrom the kont stack and integrates theValinto whatever pending operation that continuation represents — possibly producing anotherEvalstep (for the next operand), anotherApplystep (the operation produced a final value), or terminating the loop (kont stack empty).
Variants§
Eval
Evaluate exp under env. The result is fed to whatever
continuation is on top of the stack.
Apply
Apply the topmost continuation to val. If the stack is empty,
val is the final result.