WebAssembly from the Ground Up – learn WASM by building a compiler
Hi HN! We (pdubroy & marianoguerra) just launched an online book called WebAssembly from the Ground Up. It's an online book to learn Wasm by building a simple compiler in JavaScript. This is the book we wish we'd had 3 years ago. Unlike many WebAssembly resources that focus on use cases and tooling, we wanted a deep dive into how Wasm actually works. We focus on the core of WebAssembly: the module format and the instruction set. We think the low-level details — the "virtual ISA" — are the most interesting part, and we had the crazy idea that writing a compiler is the best way to learn it.…
What it does
In the maker’s words, at launch
Hi HN! We (pdubroy & marianoguerra) just launched an online book called WebAssembly from the Ground Up. It's an online book to learn Wasm by building a simple compiler in JavaScript. This is the book we wish we'd had 3 years ago. Unlike many WebAssembly resources that focus on use cases and tooling, we wanted a deep dive into how Wasm actually works. We focus on the core of WebAssembly: the module format and the instruction set. We think the low-level details — the "virtual ISA" — are the most interesting part, and we had the crazy idea that writing a compiler is the best way to learn it. Over the course of the book, you'll build up two things: 1. An "assembler library", that can be used to produce WebAssembly modules. Here's an example: const mod = module([ typesec([functype([], [])]), funcsec([typeidx(0)]), exportsec([export_('main', exportdesc.func(0))]), codesec([code(func([], [instr.end]))]), ]); return Uint8Array.from(mod.flat(Infinity)); 2. A very simple compiler for a language called Wafer, which looks like this: extern func setPixel(x, y, r, g, b, a); func draw(width, height, t) { let y = 0; while y < height { let x = 0; while x < width { let r = t; let g = x; let b = y; let a = 255; setPixel(x, y, r, g, b, a); x := x + 1; } y := y + 1; } 0 } In case you're not a fan of JavaScript, we've already heard of readers who've worked through the book in F# and Haskell. :-D You can check out a sample here: https://wasmgroundup.com/book/contents-sample/ — we'd love to hear what you think! There's also a 25% discount for HN readers — just use the code HNWASM25 at checkout.
Does the same job
all alternatives →
- AEAn Easy Programming Language – Built with WebAssembly2019 · easyprog.online · ▲144
- ACAsmble – Compile WebAssembly to the JVM2017 · github.com · ▲49
- JBJavaScript books, free online2016 · exploringjs.com · ▲222
- AEAn Easy Programming Language That Runs in the Browser via WebAssembly2021 · easylang.online · ▲32
- ZKZero-Knowledge Proofs in WebAssembly2019 · zkwasm.kobi.one · ▲81
More life & fun this month
the category →- TL
Life & fun · 10d ago · louisabraham.github.io

Photosynthesis fires two of your iPhone
Life & fun · 28d ago · photosynthesis.camera
SoloUno▲310Take control of hair pulling, nail biting & skin picking
Life & fun · 28d ago · solouno.io

Scroll through all 43,252,003,274,489,856,000 reachable Rubik's Cube permutations.
Life & fun · 26d ago · everycube.alen.is


Hi HN, I built Eigendrum, a web tool that solves the 2D wave equation for arbitrary shapes so you can hear what they sound like as drums. How it works: * Solves -∇²u = λu using finite element analysis (Kφ = λMφ) on a triangle mesh. * Validated to <0.1% error against closed-form solutions for circles (Bessel zeros) and rectangles. * Sound model factors in strike location, Rayleigh damping, and mallet width. * Includes Kac drums I & II to demonstrate identical sound spectra from different geometries. * No frameworks, build steps, or dependencies. Repo and tests:…
Life & fun · 26d ago · baselashraf81.github.io
Launched alongside, March 2025
the whole month →
Mimic Human Research & Save Findings in AI Knowledge Base
AI · 2025 · sider.ai




