WABT: The WebAssembly Binary Toolkit
wabt includes the following commands:
- wat2wasm
- wasm2wat
- wast2json
- wasm-validate
- wasm-strip
Commands
wat2wasm
Translate from WebAssembly text format to the WebAssembly binary format.
# 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
wasm2wat
The inverse of wat2wasm, translate from the binary format back to the text format (also known as a .wat).
# 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-validate
Validate a file in the WebAssembly binary format
# Validates the WebAssembly file
$ wasm-validate test.wasm
wasm-strip
Remove sections of a WebAssembly binary file
# Validates the WebAssembly file
$ wasm-strip test.wasm
wast2json
wast2json converts a file in the wasm spec test format to a JSON file and associated wasm binary files
# parse spec-test.wast, and write files to spec-test.json. Modules are written
# to spec-test.0.wasm, spec-test.1.wasm, etc.
$ wast2json spec-test.wast -o spec-test.json
Building from Source
- Run
./scripts/build_wasi.sh