Skip to content

Instantly share code, notes, and snippets.

@sfpgmr sfpgmr/test.mwat
Last active Apr 20, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.