wat2wasm —
translate from WebAssembly text format to the
WebAssembly binary format
wat2wasm translates from WebAssembly text format to
the WebAssembly binary format.
The options are as follows:
- -v,
--verbose
- Use multiple times for more info
- --help
- Print a help message
- --debug-parser
- Turn on debugging the parser of wat files
- -d,
--dump-module
- Print a hexdump of the module to stdout
- --enable-exceptions
- Experimental exception handling
- --disable-mutable-globals
- Import/export mutable globals
- --enable-saturating-float-to-int
- Saturating float-to-int operators
- --enable-sign-extension
- Sign-extension operators
- --enable-simd
- SIMD support
- --enable-threads
- Threading support
- -o,
--output=FILE
- output wasm binary file
- -r,
--relocatable
- Create a relocatable wasm binary (suitable for linking with
e.g. lld)
- --no-canonicalize-leb128s
- Write all LEB128 sizes as 5-bytes instead of their minimal
size
- --debug-names
- Write debug names to the generated binary file
- --no-check
- Don't check for invalid modules
Parse and typecheck test.wat
$ wat2wasm test.wat
parse test.wat and write to binary file test.wasm
$ wat2wasm test.wat -o test.wasm
Parse spec-test.wast, and write verbose output to stdout (including the meaning
of every byte)
$ wat2wasm spec-test.wast -v
wasm-interp(1),
wasm-objdump(1),
wasm-opcodecnt(1),
wasm-strip(1),
wasm-validate(1),
wasm2c(1),
wasm2wat(1),
wast2json(1),
wat-desugar(1),
spectest-interp(1)
If you find a bug, please report it at
https://github.com/WebAssembly/wabt/issues.