Examples

mvp0.mul

MVP-0: the smallest program that goes through the whole MUL pipeline.

Source

examples/mvp0.mul is stored in the compact layout, as AI agents write it: a space only between two words, no other whitespace. The page lays it out for reading; the Compact button shows the stored text, and Copy always copies it.

// MVP-0: the smallest program that goes through the whole MUL pipeline.
module demo pub fn main()->i32{return 2+3*4}

Verified IR

What mul ir prints after the verifier has accepted the program.

module demo

fn @main() -> i32 {
b0:
  %0 = const.i32 2
  %1 = const.i32 3
  %2 = const.i32 4
  %3 = mul.i32 %1, %2
  %4 = add.i32 %0, %3
  return %4
}

Run

The value main returns is the exit code of the process.

$ mul run examples/mvp0.mul; echo "exit code $?"
exit code 14