Skip to main content

Module eval

Module eval 

Source
Expand description

Tree-walking interpreter with heap-threading, prototype-walking field access, and throw/try-catch non-local control flow.

Spike 4 adds two new evaluation cases:

  • Expr::Throw: evaluate the inner expression, then emit Error::Thrown carrying the resulting value plus the current heap and fuel. Existing ?-propagation through every other case unwinds the stack until either an enclosing Expr::TryCatch catches the signal or it reaches the top boundary as an uncaught exception.
  • Expr::TryCatch: evaluate the body; on Error::Thrown, bind the thrown value to the catch parameter and evaluate the handler with the heap and fuel that were live at the moment of the throw. Other Error variants propagate unchanged.

Substitution traverses the new variants without introducing new binders.

Structs§

Fuel
A step budget for evaluation.

Functions§

eval
Evaluate expr against env with the given heap and step budget.