nyar-wasm

High level wasm builder

8 releases

0.0.7 May 21, 2024
0.0.6 Mar 13, 2024
0.0.4 Feb 18, 2024
0.0.3 Dec 15, 2023

26 downloads per month
Used in 3 crates

MPL-2.0 license

110KB
3K SLoC

NyarVM WebAssembly Backend

function add(a, b) -> ret {
    a + b
}

function add(a, b, ret) {
    ret(a + b)
}

let data = "hello world"
/// - file_descriptor: 文件描述符, 比如 `stdout` 的文件描述符为 1
/// - memory: 数据在哪个内存, 这一项总是传 0.
/// - length: 字符串的长度
/// - nwritten: 写入的字节数
#ffi("wasi_snapshot_preview1", "fd_write")
function fd_write(file_descriptor: i32, memory: i32, length: i32, nwritten: i32): i32 {

}


class UTF8Text {
    private buffer: array<u8>
}

structure UTF8View {
    offset: u32,
    length: u32,
}

let data = "hello world";

#main
function run() {
    fd_write(1, 0, 1, 20)
    @asm("drop")
}

Dependencies

~7–13MB
~171K SLoC