Walt is a JavaScript-like syntax for WebAssembly text format
MIT License
Bot releases are hidden (Show)
walt-compiler
type Integer = i32;
|
operator in type declarations. Eg. type Indexed = SomeStruct | i32[];
.&
operator. Eg. type String = { byteLength: i32, &data: i32[] };
INTROSPECT_*
exports, which can print debug version of the syntax without editing test harness logic.Published by ballercat almost 6 years ago
Bugfix and stabilize nested property/struct access.
type Node = {
value: i32,
left: Node,
right: Node
}
...
node.left.right.left; // etc.,
Published by ballercat about 6 years ago
This PR adds support for the throw
keyword. It proxies to the unreachable
instruction in the WebAssembly spec. As per spec nothing can be actually "thrown" with the runtime exception.
function test() {
throw;
}
The syntax does reserve an expression after the throw
keyword for future use so this code is also valid, although the expression is ignored after the throw.
function test() {
// May throw the result of expression in the future if WebAssembly supports it
throw somefunction(2 + 2, another());
}
Published by ballercat about 6 years ago
This release adds new syntax sugar for data sections, memory size/resize operations and bug fixes to the CLI tool.
WebAssembly Spec allows for the declaration of static regions of memory which can be pre-defined in the wasm source.
https://github.com/WebAssembly/spec/blob/master/test/core/data.wast
(module
(memory $m 1)
(data (i32.const 0))
(data (i32.const 1) "a" "" "bcd")
(data (offset (i32.const 0)))
(data (offset (i32.const 0)) "" "a" "bc" "")
(data 0 (i32.const 0))
(data 0x0 (i32.const 1) "a" "" "bcd")
(data 0x000 (offset (i32.const 0)))
(data 0 (offset (i32.const 0)) "" "a" "bc" "")
(data $m (i32.const 0))
(data $m (i32.const 1) "a" "" "bcd")
(data $m (offset (i32.const 0)))
(data $m (offset (i32.const 0)) "" "a" "bc" "")
)
This exact pattern was impossible to implement in Walt previous. Now the developer may define these sections with an array literal syntax at global scope inside a walt module.
const array: i32[] = ['<', 'a', 'b', 1, 2, 3];
Any combination of Walt Primitives is allowed in the array literal as long as they map to the type of the array, however expressions and function calls are not.
WebAssembly spec supports memory resizing from within the binary with a set of memory resizing instructions. This is now supported by Walt syntax by the following methods on an Object of type Memory
:
memory.size()
- maps to current_memory
opcodememory.grow()
- maps to grow_memory
opcode, requires a parametermemory.dataSize()
- syntax sugar for getting size of the combined data section regions. Reads zeroth word of memory.walt-cli
has a number of bug fixes to make it operate as designedwalt-compiler
fixed a bug with escape sequences not working as expected inside character literalsPublished by ballercat about 6 years ago
Published by ballercat about 6 years ago