Build & Development Commands
- Use
wat2wasm
to compile WebAssembly Text Format (WAT) to binary .wasm
files
- Validate modules with
wasm-validate
to ensure compliance with structured control flow rules
Testing Guidelines
- Verify control flow integrity by checking nested block/loop/if structures
- Test branch instructions (
br
, br_if
) to ensure they target valid labels
- Validate memory operations with explicit
offset
/align
values
Code Style & Guidelines
- Structured Control Flow: Enforce nested blocks/loops with explicit labels and
end
markers
- Explicit Types: Declare types for blocks, functions, and results (e.g.,
(block (result i32) ...)
)
- Memory Operations: Always specify
offset
and align
immediates
- S-Expression Folding: Use nested expressions for complex operations (no flat sequences)
Documentation Guidelines
- Annotate WAT files with block comments for high-level logic and inline comments for non-obvious instructions
- Document structured control flow patterns (e.g., labeled loops) to aid readability
- Maintain human-readable WAT alongside binary
.wasm
files for debugging