Sign in

    wasmtools

    A tool to convert between WebAssembly and WAT.

    wasm
    wat
    parser
    Download zip
    Author
    Version
    0.1.0
    License
    GPL-3.0-or-later
    Last updated
    last year
    Downloads
    42

    #AdUhTkJm/wasmtools

    This is a parser and converted of WebAssembly file. It is far from complete; see current progress section to view the work done.

    Because of Moonbit constraints, all vectors cannot exceed 2^31 elements long, while the specification actually requires support up to 2^32. I believe it is uncommon that we will encounter files this large.

    #Usage

    Usage:

    let binary = // The binary WASM source let parser = Parser::wasm(binary); // Gives a Module that contains various sections. // You can refer to the WebAssembly specification to understand their meanings. let module = parser.parse_module(); // The `Show` trait is implemented. The module is shown in WAT form. println(module);

    Therefore, if you don't need to examine the interals of the WebAssembly module, you can just use it as a WASM -> WAT converter. Parsing and emission for the other direction is still under development.

    #Current progress

    This supports only the main WASM 2.0 standard. Only the exception extension is supported: if you want to experiment with output from Moonbit compiler, be sure to compile with wasm backend rather than wasm-gc.

    This now parses only 3 sections, namely the type section (0), import section (1) and tag section (13). The project is under active development and parsing for more sections will be added in the future.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io