Difference between revisions of "WebAssembly"
From Free Pascal wiki
Jump to navigationJump to searchm (→See Also) |
m (→See Also) |
||
Line 1: | Line 1: | ||
+ | ==Assemblers== | ||
+ | There are different assemblers available, from Wabt and emscripten.org. | ||
+ | The expected format is a slightly different between those two: | ||
+ | |||
+ | '''wat2wasm''' (Wabt) | ||
+ | (module | ||
+ | (func $add (param $lhs i32) (param $rhs i32) (result i32) | ||
+ | local.get $lhs | ||
+ | local.get $rhs | ||
+ | i32.add | ||
+ | ) | ||
+ | (export "add" (func $add)) | ||
+ | ) | ||
+ | |||
+ | '''wasm-as''' (emscripten) | ||
+ | (module | ||
+ | (func $add (param $lhs i32) (param $rhs i32) (result i32) | ||
+ | ( | ||
+ | local.get $lhs | ||
+ | local.get $rhs | ||
+ | i32.add | ||
+ | ) | ||
+ | ) | ||
+ | (export "add" (func $add)) | ||
+ | ) | ||
==See Also== | ==See Also== | ||
* https://webassembly.org/ - the official site | * https://webassembly.org/ - the official site |
Revision as of 18:18, 30 August 2019
Assemblers
There are different assemblers available, from Wabt and emscripten.org. The expected format is a slightly different between those two:
wat2wasm (Wabt)
(module (func $add (param $lhs i32) (param $rhs i32) (result i32) local.get $lhs local.get $rhs i32.add ) (export "add" (func $add)) )
wasm-as (emscripten)
(module (func $add (param $lhs i32) (param $rhs i32) (result i32) ( local.get $lhs local.get $rhs i32.add ) ) (export "add" (func $add)) )
See Also
- https://webassembly.org/ - the official site
- https://webassembly.github.io/spec/core/text/index.html - text format (S-Expression) specs
- https://webassembly.github.io/spec/core/binary/index.html - binary format specs
- https://rsms.me/wasm-intro - introduction to webassembly