Wasmly
This is a minimalistic web assembly tool for creating modules from arrays of bytes. This helps you develop much more closer to how web assembly apps exist at a low level.
If you check this project out and just want to get the dependencies to setup:
make setup
Go into any example directory:
make
make serve
Then open a browser to http://localhost:9999
Check the console for output!
If you are using this as a npm module
npm install wasmly
Very Simple Modules
If all you are doing is writing a single exported "main" function that takes in inputs, returns an output, and exposes "memory". Try this to save boiler plate:
var fs = require;
let = require;
// main() -> i32
app =
fs.
Simplest Module Possible
If you are trying to create the most simplest module from scratch. This has no functions
var fs = require;
let = require;
app =
// this is just a nested array of bytes:
// [[[0, 97, 115, 109]][[1, 0, 0, 0]]]
fs.
Not very useful!
main()
From Scratch
...
// main() -> i32 { return 42 }
main_function_signature = // function signature returns 42
main_function_code =
//lets make memory at least 2 pages and at most 10 pages long
memory =
// put it all together as a module
app =
...
Memory Allocator
Let's make a very simple memory allocator.
...
// malloc(length:i32) -> i32 { ... }
malloc_function_signature = // function signature returns 42
malloc_function_code =
// create a heap global set to zero
heap_global =
//lets make memory at least 2 pages and at most 10 pages long
memory =
// put it all together as a module
app =
...