PtcRunner.Lisp.Eval (PtcRunner v0.4.1)
View SourceEvaluates CoreAST into values.
The eval layer recursively interprets CoreAST nodes, resolving variables from lexical environments, applying builtins and user functions, and handling control flow.
Module Structure
This module delegates to specialized submodules:
Eval.Context- Evaluation context structEval.Patterns- Pattern matching for let bindingsEval.Where- Where predicates and comparisonsEval.Apply- Function application dispatchEval.Helpers- Type errors and utilities
Summary
Types
@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()} | {:cannot_shadow_builtin, atom()}
Functions
@spec eval(PtcRunner.Lisp.CoreAST.t(), map(), map(), env(), tool_executor(), list()) :: {:ok, value(), map()} | {:error, runtime_error()}
@spec eval_with_context( PtcRunner.Lisp.CoreAST.t(), map(), map(), env(), tool_executor(), list() ) :: {:ok, value(), PtcRunner.Lisp.Eval.Context.t()} | {:error, runtime_error()}