feat(runtime): tree-walk interpreter for Marqdo IR
Blueprint sections 7.2 and 3: Marqdo executes with its own Rust interpreter. - Frames with isolated scopes, named/positional argument binding, explicit signature rules, compile-time constant defaults evaluated in an empty frame. - Statements: assignment, expression statements, link-form calls, branch (first true arm), loop (condition re-evaluated, return propagates), return. - Expressions: exact Int arithmetic, `/` always Float, mixed arithmetic Float, exact Int/Float comparisons via rationals, Text concatenation, short-circuit and/or, Bool-only conditions, indexes with negative positions, map/Formula/ Code member access, calls (same module, imports, FunctionRef values). - Builtins: print/len/type/str/int/float/table/ref plus capability-host dispatch for math.*, foreign.*, fs.*; `ref` resolves functions or exactly one inert resource and errors on ambiguity instead of picking the first. - Fuel, stack-depth and wall-clock budgets are enforced; call errors carry a structured stack of frames. - End-to-end tests: recursion, loops, explicit positional signatures, builtins, function references, non-Bool conditions, fuel/stack exhaustion, ambiguous references.
This commit is contained in:
1 parent
d54fda9e78
commit
2e49c7b855
6 files changed
+1709
No files matched your search
@@ -0,0 +1,15 @@
|
||||
//! Rust tree-walk interpreter for Marqdo IR.
|
||||
//!
|
||||
//! The interpreter is Marqdo's own execution engine: expressions, scoping,
|
||||
//! calls, branches, loops and returns are evaluated here, never by translating
|
||||
//! to Python or another language. Every side effect goes through
|
||||
//! [`marqdo_host::Host`]; prose never reaches this layer because it is absent
|
||||
//! from the IR.
|
||||
|
||||
mod builtins_impl;
|
||||
mod interpreter;
|
||||
mod value_ops;
|
||||
|
||||
pub use interpreter::{run, EvaluatedArg, Interpreter, RunOutcome};
|
||||
|
||||
pub use marqdo_value::{RuntimeError, Value};
|
||||
Reference in new issue
Block a user