Questions Concepts
GitHub icon

WebAssembly

WebAssembly - Bytecode format

< >

WebAssembly is an open source bytecode format created in 2015 by Alon Zakai.

Source code:
git clone https://github.com/WebAssembly/wabt
#114on PLDB 8Years Old 2kRepos

Try now: TIO

WebAssembly (Wasm, WA) is a web standard that defines a binary format and a corresponding assembly-like text format for executable code in Web pages. It is meant to enable executing code nearly as fast as running native machine code. It was envisioned to complement JavaScript to speed up performance-critical parts of web applications and later on to enable web development in languages other than JavaScript. Read more on Wikipedia...


Example from the web:
20 00 50 04 7E 42 01 05 20 00 20 00 42 01 7D 10 00 7E 0B
Example from hello-world:
(module (import "wasi_unstable" "fd_write" (func $fd_write (param i32 i32 i32 i32) (result i32)) ) (memory 1) (export "memory" (memory 0)) (data (i32.const 0) "\08\00\00\00\0c\00\00\00Hello World\n") (func $main (export "_start") i32.const 1 i32.const 0 i32.const 1 i32.const 20 call $fd_write drop ) )
Example from Linguist:
(module (import "env" "printInt" (func $printInt (param i32))) (func $add (param $lhs i32) (param $rhs i32) (result i32) get_local $lhs get_local $rhs i32.add ) (func $main (call $printInt (call $add (i32.const 9) (i32.const 8)))) (export "main" (func $main)) )
Example from Wikipedia:
(module (import "math" "exp" (func $exp (param f64) (result f64))) (func (export "doubleExp") (param $0 f64) (result f64) (f64.mul (call $exp (get_local $0)) (f64.const 2))))

Language features

Feature Supported Token Example
Comments
MultiLine Comments
Line Comments
Integers
Floats
Hexadecimals

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Traffic · Traffic Today · Day 305 · feedback@pldb.com · Logout