“WAT (WebAssembly Text Format) represents binary WebAssembly as nested S-expressions (symbolic expressions in Lisp-like parentheses). Tools like wat2wasm and wasm2wat convert bidirectionally between human-readable .wat and binary .wasm without loss.”
Reading and writing human-readable S-expressions, module declarations, and function signatures.
(module
(func $square (param $n f64) (result f64)
(f64.mul (local.get $n) (local.get $n))
)
(export "square" (func $square))
)const watModule = await WebAssembly.instantiate(wasmBytes);
console.log(watModule.instance.exports.square(9.0)); // 81.0Wrap module in root (module ...) expression
Declare typed functions with (param ...) and (result ...)
Use structured control flow or linear stack instructions
Export functions using (export "name" (func $id))
Compile with wat2wasm to generate production .wasm binary
Folding linear instructions into nested S-expressions ((i32.add (local.get $a) (local.get $b))) makes complex mathematical pipelines readable while compiling to identical linear bytecode.