proglangdesign.net

WebAssembly

WebAssembly is the proposed “native execution” language for web browsers, intended as a higher-performing and language-agnostic alternative to Javascript. Most popular browsers support it.

There are several approaches a language compiler can take to support WebAssembly as a target platform:

Building a WebAssembly-capable LLVM

Because the WebAssembly target (wasm32-unknown-unknown-wasm) is currently experimental, you don’t get it when building vanilla LLVM (e.g., using a package manager such as apt-get). One must custom-build LLVM, specifying “-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly” as one of the CMake options. This page shows a sequence of steps for downloading and building the LLVM toolchain correctly for WebAssembly.

Resources for Learning

These pages offer valuable information and provide useful links:

Caveats

WebAssembly is still very early in its lifecycle and only supports what they call their Minimum Viable Product (MVP). Thus: