Skip to main content

Module interp

Module interp 

Source
Expand description

Statement / Expression walker — the runtime interpreter.

Holds the mutable bookkeeping a circuit accumulates during execution (public transcript, witness outputs, popeq reads, the current contract state, the local variable scope) and walks the body IR producing an [ExecuteCircuitResult]-shaped output.

Today this handles the registry-shape body — Statement::Seq / Const / Expr, Expression::Var / Literal / Call (witness only) / AdtOp / EltRef. Surfaces a clear Unimplemented error for anything else so callers know exactly which IR node the interpreter needs to grow next.

Structs§

EmittedEvent
One emit occurrence: the tag and version the contract declared, plus the state value the VM logged.
InterpState
Mutable state the interpreter maintains during a single circuit execution.
VmSession
Persistent on-chain VM stack threaded across sequential AdtOp, Emit, and claimContractCall queries within a single circuit or constructor run.

Functions§

encode_input
Encode the circuit’s input arguments as a single concatenated AlignedValue (matching the JS-emit partialProofData.input = _descriptor_N.toValue(arg) shape).
encode_output
Encode the circuit’s result value as an AlignedValue.
eval_expression
Evaluate an expression, possibly with side effects on InterpState (witness calls update private_transcript_outputs; adt-op invocations append to public_transcript and update contract_state).
run_statement
Walk a Statement tree, threading mutable interpreter state. Returns the last-expression value (the circuit’s implicit return), or Value::Null if no expression contributed a value.

Type Aliases§

VarMap
Fast non-cryptographic variable map used for interpreter locals and args scopes.