Module evaluator

Module evaluator 

Source
Expand description

Scheme evaluator (eval loop)

Ported from OpenJade’s Interpreter.cxx (~2,000 lines).

§Core Responsibilities

  1. Evaluate expressions - Transform Values into results
  2. Special forms - Handle if, let, define, lambda, quote, etc.
  3. Function application - Call procedures with arguments
  4. Tail call optimization - Prevent stack overflow in recursive functions

§OpenJade Correspondence

DazzleOpenJadePurpose
EvaluatorInterpreterMain evaluator state
eval()Interpreter::eval()Core eval loop
apply()Interpreter::apply()Function application
eval_special()Interpreter::evalXXX()Special form handlers

§Evaluation Rules (R4RS)

  • Self-evaluating: Numbers, strings, booleans, characters → return as-is
  • Symbols: Look up in environment
  • Lists: First element determines behavior:
    • Special form keyword → handle specially
    • Otherwise → evaluate all elements, apply first to rest

Structs§

CallFrame
A call stack frame
ConstructionRule
Construction rule for DSSSL processing
EvalError
Evaluation error with call stack
Evaluator
Scheme evaluator
EvaluatorContext
Context available to primitives during evaluation
ProcessingMode
Processing mode containing construction rules

Functions§

get_evaluator_context
Get the current evaluator context (for use in primitives)

Type Aliases§

EvalResult