A WebAssembly compiler that fits in a tweet
29-Jan-2025 52
One of the initial explorations that started this book was how small and simple a compile-to-WebAssembly language implemented in JavaScript could be. Our first “WebAssembly compiler in a tweet” was 269 bytes; since then, we’ve managed to whittle it down to a measly 192 bytes.
The final result is a compiler that takes an arithmetic expression — written in reverse polish notation — and compiles it down to a valid WebAssembly module. That module exports a single function which returns the result of the original arithmetic expression. Here it is:.
A WebAssembly compiler that fits in a tweet #js #javascript #WebAssembly #compiler #tweet #compiler #webassembly https://javascript.ba/link/a-webassembly-compiler-that-fits-in-a-tweet