A JavaScript/TypeScript like language that compiles to web assembly.
Compilation takes place in phases described in the following chart. Each of these phases roughly takes place in a module of a similar name.
Wasmer is used as the WASM execution engine.
USAGE:
jswt [FLAGS] [OPTIONS] <file>
FLAGS:
-h, --help Prints help information
--log-mem Log the memory layout after execution
--minified Minify WAST output
--no-std Do not include the runtime and stdlib
-V, --version Prints version information
OPTIONS:
-o <output> Write output to file
--runtime-path <runtime-path> Path to runtime sources
ARGS:
<file> Input file to begin compiling
class Array {
length: i32;
capacity: i32;
data: i32;
constructor(capacity: i32) {
this.length = 0;
this.capacity = capacity;
this.data = malloc(capacity * 4);
}
set(index: i32, data: i32) {
i32Store(this.data + index * 4, data);
}
get(index: i32): i32 {
return i32Load(this.data + index * 4);
}
}
export function main(): i32 {
let value: i32 = 10;
let value2 = value + 33;
println(value2);
return 0;
}