Skip to main content

with_parsed_program

Function with_parsed_program 

Source
pub fn with_parsed_program<R>(
    input: &str,
    f: impl for<'a> FnOnce(Result<(&'a [Stmt<'a>], &'a TypeRegistry, PolicyRegistry), String>, &'a Interner) -> R,
) -> R
Expand description

The execution front-end shared by every engine: lex → MWE → discovery → parse. The tree-walker and the bytecode VM MUST both come through here so they see the identical token stream, type registry, and policies — a differential test that parses differently per engine is comparing two different programs.

Parsed statements borrow stack-local arenas, so they are handed to the closure rather than returned. A parse failure is delivered as Err(socratic advice text) — also identical for both engines.