Function portus::lang::compile[][src]

pub fn compile(src: &[u8], updates: &[(&str, u32)]) -> Result<(Bin, Scope)>

compile() uses 5 passes to yield Instrs.

  1. Expr::new() (called by Prog::new_with_scope() internally) returns a single AST from src
  2. Prog::new_with_scope() returns a list of ASTs for multiple expressions
  3. The ASTs are desugared to support (report) and (fallthrough).
  4. The list of runtime updates (from updates) for values is applied to the Scope.
  5. Bin::compile_prog() turns a Prog into a Bin, which is a Vec of datapath Instr