(likely wascally wabbit) Web assembly binary toolkit sudo apt install wabt
wasm2c - decompiled version wasm2wat - binary totextual wat2wasm - textual to binary wasm-interp - interpet wasm wasm-objdump - look at disassembly alongside bits
wasmer? Wait wasmer is a startup? https://news.ycombinator.com/item?id=27537541 zig as a wasm compiler for wasm C? wasmer hello.wasm -i helloWorld wasmtime
wat2wasm hello.wat wasmer hello.wasm -i mysquare 4 default wasmer is run. -i is invoke
https://github.com/AssemblyScript/wabt.js a port of wabt to assemblyscript
interesting fields in module state memory data element adds stuff to table tables funcs
https://wapm.io/ package manager - runs examples in browser?
Writing Wasm directly
Named parameters vs anonymous. Stack style vs “lispy” style
- https://developer.mozilla.org/en-US/docs/WebAssembly/ Understanding_the_text_format
- https://blog.scottlogic.com/2018/04/26/webassembly-by-hand.html - writing wasm by hand
- https://blog.scottlogic.com/2019/05/17/webassembly-compiler.html - making a webassembly compiler
- Oreilly book is most current one?
- The Art of Webassembly - no starch press
(; block comment ;) ;; line comment (module ;; (memory 1) ;; generally things seems to take names $foo or can be referred to by index. ;; 1 means 1 page big. ;;(global $g (import "js" "global") (mut i32)) (func (result i32) (i32.const 42) ) (func $mysquare (param $x i32) (result i32) (i32.mul (local.get $x) (local.get $x)) ) (func (result i32) (call $mysquare (i32.const 42)) ) (func $fact (param $x i32) (result i32) (local $acc i32) (local.set $acc (i32.const 1)) (block $done ;; out breaking block (loop ;; "loop" block (local.set $acc (i32.mul (local.get $x) (local.get $acc))) (local.set $x (i32.sub (local.get $x) (i32.const 1))) (i32.eqz (local.get $x)) (br_if $done) (br 0) ) ) (return (local.get $acc)) ) (func $mymain) (export "helloWorld" (func 0)) (export "mysquare" (func $mysquare)) (export "fact" (func $fact)) (start $mymain) )
manual linking of webassembly by passing instantiated modules to other modules. That’s cool.
import external functions export internal definitions
https://github.com/WebAssembly/wasi-sdk wasi-sdk vs emscripten vs binaryen WASI I guess is kind of like POSIX system calls or libc in some respects?
Ok you can directly execute .wat files wat2wasm –debug-names puts debug names into Custom section of wasm file
assemblyscript - an annotated version of typescript that compiles directly-ish to wasm
binaryen - an optmizing compiler that accepts some kind of cfg or wasm. Has C api. wasm-opt will optimize wasm for me wasm2js
Finicky process. There are sections in the above books about this C++ exceptions and threads are something to look for.
https://www.minizinc.org/doc-2.5.5/en/installation_detailed_wasm.html minizinc graphviz or-tools https://github.com/google/or-tools/pull/2404/files
The wasm reference interpeter is in ocaml https://github.com/WebAssembly/spec/tree/master/interpreter
What could be cool? SAT solver
Analysis on wasm https://github.com/synacktiv/toy-wasm-symbexp toy symbolic executor in haskell
https://github.com/WebAssembly/wabt binary toolkit
How do you just run a command line tool in the browser?
compiling miniznic source yadayada./emsdk_env.sh https://www.minizinc.org/doc-2.5.5/en/installation_detailed_wasm.html
mkdir build cd build emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel .. emmake cmake –build .
Hmm runnign with node does nothing. I need to make a wrapper to call MINIZINC() It needs to be in an mjs file
Lots of important stuff is in the api reference Module, FS
https://github.com/jcubic/jquery.terminal - for making web based terminals. Alternaitve for some pruposes to xterm.js
https://news.ycombinator.com/item?id=29376105 compiling stock python to wasm pyiodide