Evaluates CoreAST into values.
The eval layer recursively interprets CoreAST nodes, resolving variables from lexical environments, applying builtins and user functions, and handling control flow.
Expected evaluation exits use one context-bearing protocol owned by
Eval.Outcome: success, recoverable error, or return/fail/recur
control. Host callbacks that cannot return an outcome use the private
Eval.Abort carrier. Eval.HostContext installs the active evaluator
context around those callbacks so validation and runtime helpers can abort
without introducing parallel exception transports.
Eval.Context owns the normalized cumulative Eval.Effects. Eval.Capture
is the single callback capture stack; it records the authoritative effect
delta and replaces only an outcome context's effects during normalization.
Eval.HostContext is the one adapter for plain host callbacks. Callable
dispatch remains responsible for restoring lexical, namespace, and
prelude-authority state before an outcome crosses a boundary.
Module Structure
This module delegates to specialized submodules:
Eval.Context- Evaluation context structEval.Patterns- Pattern matching for let bindingsEval.Apply- Function application dispatchEval.Outcome/Eval.Abort- Expected outcomes and the private callback carrierEval.HostContext- Active evaluator context for host callbacksEval.Effects/Eval.Capture- Effect algebra and callback captureEval.Parallel- pmap/pcalls evaluation and worker-result semanticsEval.ParallelRunner- Parallel scheduling and process lifecycleEval.Helpers- Type errors and utilities
Summary
Types
@type outcome() :: {:ok, term(), PtcRunner.Lisp.Eval.Context.t()} | {:error, term(), PtcRunner.Lisp.Eval.Context.t()} | {:control, :return | :fail | :recur, term(), PtcRunner.Lisp.Eval.Context.t()}
@type runtime_error() :: {:unbound_var, atom()} | {:not_callable, term()} | {:arity_mismatch, expected :: integer(), got :: integer()} | {:type_error, expected :: String.t(), got :: term()} | {:tool_error, tool_name :: String.t(), reason :: term()} | {:invalid_keyword_call, atom(), [term()]} | {:arity_error, String.t()} | {:destructure_error, String.t()} | {:transitive_call_unauthorized, String.t(), String.t(), [String.t()]}
Functions
@spec eval( PtcRunner.Lisp.CoreAST.t(), map(), map(), env(), tool_executor(), list(), keyword() ) :: {:ok, value(), map()} | {:error, runtime_error()}
@spec eval_with_context( PtcRunner.Lisp.CoreAST.t(), map(), map(), env(), tool_executor(), list(), keyword() ) :: outcome()