Get started writing WebAssembly in human-readable text with this step-by-step tutorial.

WebAssembly is a bytecode format that  virtually every browser can compile to its host system’s machine code. Alongside JavaScript and WebGL, WebAssembly fulfills the demand for porting applications for platform-independent use in the web browser. As a compilation target for C++ and Rust, WebAssembly enables web browsers to execute code at near-native speed.

When you talk about a WebAssembly, application, you must distinguish between three states:

  1. Source code (e.g., C++ or Rust): You have an application written in a compatible language that you want to execute in the browser.
  2. WebAssembly bytecode: You choose WebAssembly bytecode as your compilation target. As a result, you get a .wasm file.
  3. Machine code (opcode): The browser loads the .wasm file and compiles it to the corresponding machine code of its host system.

WebAssembly also has a text format that represents the binary format in human-readable text. For the sake of simplicity, I will refer to this as WASM-text. WASM-text can be compared to high-level assembly language. Of course, you would not write a complete application based on WASM-text, but it’s good to know how it works under the hood (especially for debugging and performance optimization).

This article will guide you through creating the classic Hello World program in WASM-text.

#webassembly

How to write 'Hello World' in WebAssembly
1.25 GEEK