Skip to main content

Module ir

Module ir 

Source
Expand description

IR + compiler + interpreter — spec §9.1, §9.2, §9.3.

The IR is a finite linear sequence of opcodes (the 8-op set in Op) that compiles from an optimized AST and executes via a stack-machine interpreter (Interpreter) or a stream-fusion compiler (future). Both interpretation models produce identical dispense sequences per spec §9.2.

§Module layout

  • op — the 8-opcode enum + supporting parameter types.
  • program#[non_exhaustive] Program wrapper: immutable, accessible by value (spec §9.1).
  • compile — bottom-up AST → IR walker.
  • interpreter — stack-machine interpreter; produces a tuple stream that pulls lazily.
  • bounds — §9.3 closed-form peak-memory checker.

Re-exports§

pub use bounds::Bound;
pub use bounds::ResourceBound;
pub use bounds::check_bounds;
pub use compile::compile;
pub use interpreter::TupleStream;
pub use interpreter::interpret;
pub use op::Op;
pub use op::OrderStreamingKind;
pub use program::Program;

Modules§

bounds
§9.3 resource-bound checker.
compile
AST → IR compiler — spec §9.1.
interpreter
Stack-machine IR interpreter — spec §9.1 option (a) + §9.2 correctness contract.
op
Operator IR — spec §9.1.
program
Immutable IR Program wrapper — spec §9.1.