This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 10/5/2026.

Interpreter

~import std/interpreter

Koru Interpreter Standard Library

interpreter.kz · 1 tors · ~[runtime]

Koru Interpreter Standard Library · 24 more lines
Koru Interpreter Standard Library Enables runtime evaluation of Koru source code DESIGN: - Parses Koru source at runtime using the same parser as the compiler - Walks the AST and executes tors via registered dispatchers - Tracks bindings in an environment; validates flows before execution Usage: import std/interpreter import std/runtime // Register tors you want callable at runtime std/runtime:register(scope: "api") { greet process_order } // Interpret Koru source std/interpreter:run(source: user_input, scope: "api") | result r |> handle_result(value: r.value) | parse-error e |> respond(status: 400, body: e.message) | validation-error e |> respond(status: 400, body: e.message) | dispatch-error e |> respond(status: 500, body: e.tor)

Phantom lifecycles

Derived from the phantom labels in the declarations below — state! issues an obligation the compiler will chase, !state discharges it, a bare state holds it without moving it. Nothing here is hand-drawn.

string 1 state allocated!

value.stringify

retain <std.io:allocated!> koru_std/interpreter.kz:334