= WebAssembly text format
{c}
The <WebAssembly text format> is the readable textual encoding of <WebAssembly modules>. Parenthesized declarations describe the same structured program that can be encoded in binary. Symbolic identifiers such as `$add` help readers refer to definitions; numeric indices determine references in the underlying module.<WebAssembly Core Specification by the W3C WebAssembly Community Group>[Text format, Modules, Functions and Exports; Text format, Values, Identifiers]{ref}
For example, `(module (func (export "add") (param i32 i32) (result i32) local.get 0 local.get 1 i32.add))` declares and exports a function accepting two 32-bit <integers>. The `local.get` instructions push its arguments onto the operand stack; `i32.add` consumes them and produces the result. Inputs 3 and 4 give 7. The folded instruction `(i32.add (local.get 0) (local.get 1))` is an alternative notation for the same instruction sequence.<WebAssembly Core Specification by the W3C WebAssembly Community Group>[Text format, Instructions, Folded Instructions; Numeric Instructions, iadd]{ref}
The parentheses of a folded instruction make operand grouping visible, but do not introduce a different arithmetic operation. Decoding either spelling yields the same instruction structure. Textual readability and runtime behavior are separate: indentation can help a human follow the <WebAssembly module>, while the declared types and instruction order govern execution.
Back to article page