The Compiler
test-compiler-output

Test the compiler. Compile a source string and inspect the WAT:

fn compile_expr(input: []const u8) void {
    c_program(input);
    print("{s}", .{out[0..out_len]});
}
    print("--- WAT output ---\n", .{});
    compile_expr("2 + 3 * 4");

Expected output (the global/main wrapper plus three instructions and a return value):

(func (export "main") (result i64)
  (local $__tmp i64)
  i64.const 2
  i64.const 3
  i64.const 4
  i64.mul
  i64.add
)