walrus webassembly transformation library in rust

awesome wasm tools


(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 vs wasmtime? another competitor? An interpeter?

wasmer? Wait wasmer is a startup? zig as a wasm compiler for wasm C? wasmer hello.wasm -i helloWorld wasmtime

Simple javascript opening - instantiate streaming with fetch api. You can directly compile WAT in browser.

wat2wasm hello.wat wasmer hello.wasm -i mysquare 4 default wasmer is run. -i is invoke a port of wabt to assemblyscript

Wasm modules

interesting fields in module state memory data element adds stuff to table tables funcs package manager - runs examples in browser?

Writing Wasm directly

Named parameters vs anonymous. Stack style vs “lispy” style


 (; block comment ;)
 ;; line comment
    ;; (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 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 explore web assembly binary. highlights different pieces

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.


Wasm baby minizinc graphviz or-tools

The wasm reference interpeter is in ocaml

What could be cool? SAT solver

Analysis on wasm toy symbolic executor in haskell binary toolkit

How do you just run a command line tool in the browser?

compiling miniznic source yadayada./

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

wasmcloud - for making web based terminals. Alternaitve for some pruposes to xterm.js compiling stock python to wasm pyiodide

cheerp - an alternative to emscripten?

webvm JIT compilation of stock x86 in the brwoser. Apparently higher perfomance than bessard’s jslinux hacker news discussion

virtual x86 a similar open source project but slower?


It just worked. Incredible Runnnig the file didn’t do anything. I needed to do

const lib = require("./minizinc.js");
//var MINIZINC = {arguments: ["--help"]};

on node

It seems like it was grabbing my node parameters.

In the browser, I was able to load in and pass in a Module object MINIZINC({arguments : [”–help”]})

Trying to build gecode emcconfigure ../configure emmake make -j8

gecode build suggestions for emscripten Hmm. They build a minizinc for wasm somewhere

Ah I need release/6.3.0 branch which has the const fix.