Skip to main content

Module compile

Module compile 

Source
Expand description

AST → IR compiler — spec §9.1.

Bottom-up tree walk: each AST node emits its children’s IR sequences in left-to-right order, then its own operator(s). cartesian / zip / union use N-arity opcodes; filter / order use unary wrappers. The terminal Dispense is appended at the end.

R1 and R2 (the metadata-driven catalog entries from spec §10.2) are realized here: order(Lex, _) compiles to Op::OrderStreaming (R1); order(non-Lex, Some(n)) over an index-addressable input compiles to Op::OrderMaterialize { indexed: true } (R2); the naïve path uses indexed: false.

Functions§

compile
Compile an optimized AST to a Program. The result is ready for execution by super::interpreter::interpret.