CLI Reference
The wax binary is the primary interface for the Wax toolchain. It supports conversion between Wax, WebAssembly Text (WAT), and WebAssembly Binary (Wasm) formats.
Usage
wax [OPTIONS] [INPUT]
Positional Arguments
[INPUT]: Source file to convert/format. Supported extensions:.wax,.wat,.wasm.- If omitted,
waxreads fromstdin.
- If omitted,
Options
-
-o,--outputFILE- Output file. Writes to
stdoutif not specified.
- Output file. Writes to
-
-f,--format,--output-formatFORMAT- Specify the output format.
- Values:
wax,wat,wasm. - Default:
wasm(if not auto-detected from output filename).
-
-i,--input-formatFORMAT- Specify the input format.
- Values:
wax,wat,wasm. - Default: Auto-detected from input filename, or
waxif reading from stdin.
-
-v,--validate- Perform validation during conversion.
- For Wax: Runs type checking.
- For Wasm Text: Runs well-formedness checks.
- Disabled by default.
-
-s,--strict-validate- Perform strict reference validation (for Wasm Text). Overrides default relaxed validation.
-
--colorWHEN- Colorize output.
- Values:
always,never,auto. - Default:
auto(colors enabled only if output is a TTY).
-
--fold- Fold instructions into nested S-expressions.
- Applies typically to Wasm Text output.
-
--unfold- Unfold instructions into flat instruction lists.
- Applies typically to Wasm Text output.
-
--source-map-fileFILE- Generate a source map file.
Examples
Convert a Wax file to Wasm binary:
wax input.wax -o output.wasm
Convert a Wasm Text file to Wax (decompilation):
wax input.wat -o output.wax
Format a Wax file (round-trip):
wax input.wax -f wax
Read from stdin and write to stdout:
cat input.wax | wax -f wasm > output.wasm