Skip to main content

Module expr

Module expr 

Source
Expand description

Arb’s computational substrate: arithmetic expressions are compiled to a fusevm::Chunk and executed on the fusevm VM (Cranelift JIT for hot chunks). This is what “arb runs on fusevm” means concretely — every computed value in a spec flows through fusevm bytecode, not a bespoke evaluator.

x is the pipeline input scalar; a bareword identifier (amount, latency) is a field of the current record, resolved by the caller’s closure. Both are baked into the chunk as constants per evaluation, so no VM slot state is assumed across run(). Comparisons (== != < <= > >=) lower to fusevm’s Num* ops and yield a boolean; eval_pred reads the result via Value::is_truthy for where.

Enums§

BinOp
Expr

Functions§

eval
Evaluate as a number with no field resolver (field refs -> NaN).
eval_ctx
Lower e to a fusevm chunk (with x and resolved fields baked in), run it on the VM, and return the resulting number. resolve maps a field name to its numeric value.
eval_pred
Evaluate as a predicate with no field resolver.
eval_pred_ctx
Evaluate e as a predicate — compiled to fusevm, run on the VM, read as a boolean via Value::is_truthy. resolve maps a field name to its value.
parse
Parse an expression: numbers, x, + - * / %, comparisons (== != < <= > >=), unary -, and parentheses.