first commit

This commit is contained in:
Lorenzo Torres 2026-02-24 14:28:56 +01:00
commit b574d39a39
23 changed files with 8604 additions and 0 deletions

BIN
tests/wasm/fib.wasm Executable file

Binary file not shown.

35
tests/wasm/fib.wat Normal file
View file

@ -0,0 +1,35 @@
;; tests/wasm/fib.wat
(module
(import "env" "log" (func $log (param i32 i32)))
(memory (export "memory") 1)
(data (i32.const 0) "fib called\n")
(func $fib_impl (param $n i32) (result i32)
local.get $n
i32.const 2
i32.lt_s
if (result i32)
local.get $n
else
local.get $n
i32.const 1
i32.sub
call $fib_impl
local.get $n
i32.const 2
i32.sub
call $fib_impl
i32.add
end
)
(func (export "fib") (param $n i32) (result i32)
i32.const 0
i32.const 11
call $log
local.get $n
call $fib_impl
)
)

5
tests/wasm/fib.zig Normal file
View file

@ -0,0 +1,5 @@
extern "env" fn log(ptr: [*]u8, len: i32) void;
export fn init() void {
log(@ptrCast(@constCast("Hello world!\n")), 13);
}