Search notes:

WebAssembly

WebAssembly (Wasm) is a programming language that runs on browsers (stack based VM). Compared to JavaScript, Wasm is faster, more memory efficient and file size efficient and safer.
Wasm can't access the DOM API.
WebAssembly is supported (2019?) by Firefox, Chrome, Safari, Edge
The specification is defined by W3C as a long-live web standard.

Compiling c source

A C source file can be compiled into Wasm with emscripten:
The folllowing command produces a .wast file.
$ emcc -O3 -g source.c
It is also possible to create a html file:
$ emcc -O3  source.c -o webPage.html
$ python3 -m http.server 8888
$ open localhost:8888/webPage.html

Runtime environment of emscripten

emscripten provides a Unix like runtime environment.
Noteable features that are missing are:

Misc

When executing WebAssembly, a browser will enforce the same-origin and permissions policies (as it does when executing other code).
Plans for the future

WAT

WAT (WebAssembly Text) is a pseudo assembly language for the WebAssembly virtual machine.
WAT has two primary coding styles:
  • Linear instruction list style (instructions operating on a stack (push/pop))
  • S-Expressions
The The WebAssembly Binary Toolkit (wabt) comes with the wat2wasm tool which translates WebAssembly text format to the WebAssembly binary format.

WASI

WASI is the WebAssembly System Interface.

See also

WebAssmebly is part of the Web platform.

Index