This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 9/16/2026.
Interpreter.run
~import std/interpreter.runKoru Standard Library: the `run` part of interpreter.kz — the main
interpreter.run.kz · 3 tors
Koru Standard Library: the `run` part of interpreter.kz — the main
interpreter events (run / run-cached / eval) and the flow-execution core.
Joined via `~part run` in interpreter.kz; merged into the interpreter
module at load.
MAIN INTERPRETER EVENTS
Parse and execute in one step - the main interpreter entry point
Use get-scope to get the dispatcher first, then pass it here
// Koru Standard Library: the `run` part of interpreter.kz — the main
// interpreter events (run / run-cached / eval) and the flow-execution core.
// Joined via `~part run` in interpreter.kz; merged into the interpreter
// module at load.
//
// MAIN INTERPRETER EVENTS
//
// Parse and execute in one step - the main interpreter entry point
// Use get-scope to get the dispatcher first, then pass it here
~[retain] pub tor run {
source: string,
dispatcher: DispatchFn,
cost_fn: ?CostFn,
creates_obligations_fn: ?ObligationsArrayFn,
discharges_obligations_fn: ?ObligationsArrayFn,
discharge_event_fn: ?DischargeEventFn,
creates_spec_fn: ?CreatesSpecFn,
discharges_spec_fn: ?DischargesSpecFn,
budget: ?u64,
handle_pool: ?*HandlePool,
fail_fast: bool,
scope_name: string,
auto_discharge: bool,
defined: ?*DefinedFlows,
lenient: bool
}
| result { value: Value, used: u64, handles: u32 }
| unhandled-branch { branch: string, payload: string, handles: string }
| exhausted { used: u64, last_event: string, handles: u32 }
| parse-error { message: string, line: u32, column: u32 }
| validation-error string
| dispatch-error { event_name: string, message: string }// Cached parse + execute (reuses parsed flow for identical source input)
~[retain] pub tor run-cached {
source: string,
dispatcher: DispatchFn,
cost_fn: ?CostFn,
creates_obligations_fn: ?ObligationsArrayFn,
discharges_obligations_fn: ?ObligationsArrayFn,
discharge_event_fn: ?DischargeEventFn,
creates_spec_fn: ?CreatesSpecFn,
discharges_spec_fn: ?DischargesSpecFn,
budget: ?u64,
handle_pool: ?*HandlePool,
fail_fast: bool,
scope_name: string,
auto_discharge: bool,
defined: ?*DefinedFlows,
lenient: bool
}
| result { value: Value, used: u64, handles: u32 }
| unhandled-branch { branch: string, payload: string, handles: string }
| exhausted { used: u64, last_event: string, handles: u32 }
| parse-error { message: string, line: u32, column: u32 }
| validation-error string
| dispatch-error { event_name: string, message: string }// Execute pre-parsed AST - for benchmarks and advanced use
// This is the fast path: no parsing overhead, just execution!
~[retain] pub tor eval {
flow: *const ast.Flow,
dispatcher: DispatchFn,
cost_fn: ?CostFn,
creates_obligations_fn: ?ObligationsArrayFn,
discharges_obligations_fn: ?ObligationsArrayFn,
discharge_event_fn: ?DischargeEventFn,
creates_spec_fn: ?CreatesSpecFn,
discharges_spec_fn: ?DischargesSpecFn,
budget: ?u64,
handle_pool: ?*HandlePool,
scope_name: string,
auto_discharge: bool,
defined: ?*DefinedFlows,
lenient: bool
}
| result { value: Value, used: u64, handles: u32 }
| unhandled-branch { branch: string, payload: string, handles: string }
| exhausted { used: u64, last_event: string, handles: u32 }
| validation-error string
| dispatch-error { event_name: string, message: string }