WAST — one IR, pluggable surface syntaxes

WAST is a high-level IR for WASM Components. The same wast component (types + functions + bodies) renders as multiple surface syntaxes via to_text plugins (currently raw / ruby-like / ts-like / rust-like, more planned), and compiles to a running WASM Component via wit-component.

Architecture

text <──syntax plugin──> partial/full WastComponent
partial WastComponent <──partial manager──> full WastComponent
WastComponent <──file manager──> [wast, wit, syms]
[wast, wit] --compiler--> wasm component

Key design principles

  • Names are not code essence — all identifiers are meaningless UIDs.
  • wasm generation requires only wast + wit — syms are never needed.
  • Minimize identifier change cost — UIDs are stable, display names are in syms.
  • WastComponent is the central type — partial and full share the same type definition.

Syntax plugins · same IR, four surface syntaxes

Compile & run in the browser (click to expand)

Each card below is the same wast component compiled to a WASM Component, transpiled with jco, and imported as an ES module in this page. Edit the inputs or pick a preset, then Run to call the guest function. No server round-trip.