Odd Check Module - Wat Typing CST Test
Loading…
Odd Check Module — Wat Code
A WAT module that checks if a number is odd.
# wat/demo/odd.wat
(module
(func $isOdd (param $n i32) (result i32)
local.get $n
i32.const 2
i32.rem_s
i32.const 0
i32.ne)
(export "isOdd" (func $isOdd))
)Wat Language Guide
WAT (WebAssembly Text Format) is the human-readable, assembly-like syntax used to represent WebAssembly binaries. It allows developers to write, inspect, debug, and understand Wasm modules using a clear, text-based format before compiling to .wasm.
Primary Use Cases
- ▸Learning WebAssembly internals
- ▸Debugging or inspecting Wasm modules
- ▸Creating tiny hand-crafted Wasm binaries
- ▸Reverse engineering WebAssembly
- ▸Testing Wasm instructions or host bindings
Notable Features
- ▸Human-readable text representation of Wasm
- ▸Direct 1:1 mapping to WebAssembly binary
- ▸Minimal syntax with S-expression format
- ▸Precise control over memory, tables, types, and functions
- ▸Perfect for inspection, debugging, and educational use
Origin & Creator
WebAssembly was created by engineers from Mozilla, Google, Microsoft, and Apple. WAT is part of the core WebAssembly specification managed by the W3C WebAssembly Community Group.
Industrial Note
WAT is essential for low-level debugging, reverse engineering, creating minimal Wasm modules, and understanding how higher-level languages compile to WebAssembly.