A language trying to simplify WebAssembly Text syntax while keeping the full expressiveness and retro-compatibility. Unwittingly becoming a Zig toolchain for WASM.
Pronounced \vwa.la\
as in french voila (meaning here it is). The exact acronym's composition is unspecified but can be interpreted as WebAssembly Language Adaptor or What Another Linguistic Anomaly.
It is implemented as a set of complementary extensions over standard WebAssembly Text Format
func $fib export()
u64 $n -> ?
if {$n <= 2}
1
+
$fib{$n - 2}
$fib{$n - 1}
Is expended to:
(module
(func $fib (export "fib") (param $n i64) (result i64)
(if (result i64) (i64.le_u (local.get $n) (i64.const 2))
(i64.const 1)
(i64.add
(call $fib (i64.sub (local.get $n) (i64.const 2)))
(call $fib (i64.sub (local.get $n) (i64.const 1)))))))
For working samples see: fib, fizzbuzz, 99bottles, ...
git clone https://github.com/CalmSystem/wala.git
cd wala
zigmod ci
zig build -Drelease-safe
PATH=$PATH:./zig-out/bin
- Run built module (default WASI engine:
--runtime wasmtime
)
wala run samples/hello.wala
- Convert
samples/fib.wala
to Wasm
wala build samples/fib.wala > fib.wasm
Deducing parentheses from indentation based on Readable Lisp S-expressions Project's Spir110
{"hello" upper}
->(upper "hello)
{a + b}
->(+ a b)
{a * b * c}
->(* a b c)
{$fn call a b c}
->(call $fb a b c}
Like function calls
cos(v)
->(cos v)
e()
->(e)
sum(a b c)
->(sum a b c)
f{n + 1}
->(f (+ n 1))
42i32
->(i32.const 42)
(i32.add 35 7)
->(i32.add (i32.const 35) (i32.const 7))
(i64.add 35 7)
->(i64.add (i64.const 35) (i64.const 7))
(+ 35i32 7)
->(i32.add (i32.const 35) (i32.const 7))
(+ 35i64 7)
->(i64.add (i64.const 35) (i64.const 7))
($a_func $a_param $a_global)
->(call $a_func (local.get $a_param) (global.get $a_global))
{$a_local = 5}
->(local.set $a_local (i32.const 5))
{$a_global = 5}
->(global.set $a_local (i32.const 5))
{42s64 <= 1}
->(i64.le_s (i64.const 42) (i64.const 1))
{42u64 <= 1}
->(i64.le_u (i64.const 42) (i64.const 1))
{$C := 5} (call $func $C $C)
->(call $func (i32.const 5) (i32.const 5))
No need to specify blocks and function result types
Allows to define, import and use wit
declarations. See fib.wasi.wal
Distributed under the MIT license to facilitate cooperation and knowledge sharing. However, use with respect to contributors and end-users is strongly advised. See LICENSE for more information.