7 # The hello world program available at https://c9x.me/compile/
9 helloWorld = writeText "hello-world.ssa" ''
10 function w $add(w %a, w %b) { # Define a function add
12 %c =w add %a, %b # Adds the 2 arguments
13 ret %c # Return the result
15 export function w $main() { # Main function
17 %r =w call $add(w 1, w 1) # Call add(1, 1)
18 call $printf(l $fmt, w %r, ...) # Show the result
21 data $fmt = { b "One and one make %d!\n", b 0 }
26 name = "qbe-test-can-run-hello-world";
29 ${qbe}/bin/qbe -o asm.s ${helloWorld}
31 ./out | grep 'One and one make 2!'