pub struct Evaluator {
pub env: Environment,
pub gas: u64,
pub gas_limit: u64,
pub log_output: Vec<String>,
pub action_names: Vec<String>,
pub mock_responses: Vec<(String, String, Value)>,
}Expand description
The core evaluator — walks AST nodes and produces Values.
Fields§
§env: EnvironmentVariable environment (scoped).
gas: u64Gas counter — limits total steps to prevent infinite loops.
gas_limit: u64Gas limit.
log_output: Vec<String>Captured log output from core.log.
action_names: Vec<String>Action names registered in the space (for resolving action references).
mock_responses: Vec<(String, String, Value)>Mock capability responses (module, function) → response Value.
Used by the test runner for with_responses blocks.
Implementations§
Source§impl Evaluator
impl Evaluator
Sourcepub fn eval_expr(&mut self, expr: &Expr) -> EvalResult<Value>
pub fn eval_expr(&mut self, expr: &Expr) -> EvalResult<Value>
Evaluate an expression to a Value.
Sourcepub fn eval_qualified_call(
&mut self,
module: &str,
function: &str,
args: &[Expr],
) -> EvalResult<Value>
pub fn eval_qualified_call( &mut self, module: &str, function: &str, args: &[Expr], ) -> EvalResult<Value>
Evaluate a qualified call: module.function(args).
pub fn eval_if_expr(&mut self, if_expr: &IfExpr) -> EvalResult<Value>
pub fn eval_lambda(&mut self, lambda: &LambdaExpr) -> EvalResult<Value>
Sourcepub fn eval_block(&mut self, block: &Block) -> EvalResult<Value>
pub fn eval_block(&mut self, block: &Block) -> EvalResult<Value>
Execute a block of statements. Returns the value of the last expression, or Nil.
Sourcepub fn eval_stmt(&mut self, stmt: &Stmt) -> EvalResult<Value>
pub fn eval_stmt(&mut self, stmt: &Stmt) -> EvalResult<Value>
Execute a single statement.
Sourcepub fn call_stdlib(
&mut self,
module: &str,
function: &str,
args: Vec<Value>,
) -> EvalResult<Value>
pub fn call_stdlib( &mut self, module: &str, function: &str, args: Vec<Value>, ) -> EvalResult<Value>
Call a stdlib function by module and function name.
Sourcepub fn structural_eq(&self, a: &Value, b: &Value) -> bool
pub fn structural_eq(&self, a: &Value, b: &Value) -> bool
Deep structural equality. NaN != NaN. Functions always false.
Sourcepub fn value_to_display_string(&self, val: &Value) -> String
pub fn value_to_display_string(&self, val: &Value) -> String
Convert a Value to its display string (for string interpolation, core.log, etc.)
Sourcepub fn string_comparison(&self, _a: &str, _b: &str) -> Ordering
pub fn string_comparison(&self, _a: &str, _b: &str) -> Ordering
String comparison for ordering (used by string comparison operators). Note: PEPL spec says string comparison compares by length, not lexicographic. This matches the eval_comparison implementation.