After two and a half years of work with Patrick Dubroy, we are happy to announce the release of WebAssembly from the Ground Up, a book that teaches you about WebAssembly 1.0 by building a simple compiler in JavaScript with Ohm/JS.
Here’s a 25% discount code you can use: FOCWASM25
We decided to do a “digital first” book to take advantage of interactivity and “explorable explanations”, and learned a couple of things along the way.
We also decided that all the code should be in the book and that it should run if you copy and paste the snippets as you read.
To achieve this we had to create most of the tooling around the book ourselves:
- The server that handles authentication and access to the book
- The script that extracts the snippets from the original source code and generates:
- The snippets you can copy to clipboard.
- The “Copy up to here” code segments.
- The checkpoints and chapter modules in the code repo, accessible through stackblitz.
- The emit library, a standalone library to emit WebAssembly 1.0 binary modules.
- The early access feedback system using embedded hypothes.is
- PDF generation (puppeteer, pdftk, imagemagick, poppler).
- A tool to generate code snippet ranges for “highlight on text hover”.
We plan on writing about some of our takeaways in the coming weeks, but that will have to wait. 😅
Let us know if you have any questions!
📝 WebAssembly from the Ground Up
A book about WebAssembly — learn Wasm by building a simple compiler in JavaScript.
Congrats you two! I've been eagerly awaiting the final release, and am super excited to dig in. Ever since WASM appeared on the scene, I've wanted to learn how it works at a low level, and this book's approach (start with the bytecode, then write your own compiler) seems perfectly suited to my goals. Thanks for all the hard work putting this together.
Bought the book, thanks for all your work on this! I'm also interested to read your eventual post about all this behind the scenes tech you had to build. 😄
Ohm and WASM seems like a super cool combo for programming language experimentation