Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Examples

This section walks through several real PVM programs. For each example we show:

  1. The original source code (WAT or AssemblyScript)
  2. Basic metadata about the compiled binary
  3. The decompiled pseudo-code output
  4. Where available, the LLM-refined output with better variable names

The examples go from simple to more complex:

  • Branch Table – a small WAT program with switch/case style branching
  • Fibonacci (WAT) – classic fibonacci in WebAssembly text format
  • Fibonacci (AssemblyScript) – same algorithm compiled from AssemblyScript, shows how a higher-level language compiles differently
  • Control Flow – a larger example with if/else, while, nested for loops, and break
  • JAM Fuzzy Service – a real-world Rust JAM service (~142 KB, 63 functions, no source available)
  • Ananas – a real-world AssemblyScript JAM service (~442 KB, 189 functions, source on GitHub)

The next examples show more complex patterns:

Each example can be reproduced by running the decompiler on files from the examples/compiled/ directory.