Skip to content

Instantly share code, notes, and snippets.

@sfpgmr
Last active April 20, 2019 02:03
Show Gist options
  • Save sfpgmr/1af26755495b676d54f59ea2980335ca to your computer and use it in GitHub Desktop.
Save sfpgmr/1af26755495b676d54f59ea2980335ca to your computer and use it in GitHub Desktop.
WASMテキストモードのプリプロセスをJSでできるようにしてみた。
;; block
{@
$.X = 0x1;
$.Y = 2;
$.Z = 0x3;
}
;; code
(module
(export "test" (func $test))
(memory $memory 1)
(export "memory" (memory $memory))
(func $test (result i32)
i32.const @X;; comment
i32.const {$ $.X + $.Y }
i32.add
i32.const {
++$.X; return $.X + $.Y;
}
i32.mul
)
)
;; block
;; code
( module
( export "test" ( func $test ) )
( memory $memory 1 )
( export "memory" ( memory $memory ) )
( func $test ( result i32 )
i32.const 1 ;; comment
i32.const 3
i32.add
i32.const 4
i32.mul
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment