24 lines
614 B
Plaintext
24 lines
614 B
Plaintext
(with_import "./wasm.kp"
|
|
(let (
|
|
_ (println "args" *ARGV*)
|
|
(_ _ out) (cond (!= (len *ARGV*) 3) (error "wrong number of params")
|
|
true *ARGV*)
|
|
_ (println "out" out)
|
|
wasm_code (module
|
|
(func $add (param $num i32) (result i32)
|
|
(local $tmp1 i32)
|
|
(local $tmp2 i32)
|
|
(i32.const 11)
|
|
(local.get $num)
|
|
i32.add
|
|
(i32.add (local.get $num))
|
|
)
|
|
; nothing
|
|
(export "add" (func $add))
|
|
)
|
|
|
|
|
|
_ (write_file out (wasm_to_binary wasm_code))
|
|
return_code 0
|
|
) return_code ))
|