npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

maiawasm

v1.2.8

Published

MaiaWASM: WAT-to-WASM assembler with EBNF-generated parser.

Readme

MaiaWASM

tREx

WAT-to-WASM assembler in JavaScript, with a parser generated from EBNF grammar and a tREx-based pipeline (maiacc submodule).

Process Documentation

Mandatory cross-repository synchronization workflow:

Overview

This repository provides:

  • WebAssembly module assembly from WAT
  • WAT parser generated from grammar/WAT.ebnf
  • validation suites for stable and proposal-spec scenarios

The recommended workflow for syntax and parser changes is always:

  1. update the grammar (grammar/WAT.ebnf)
  2. regenerate the parser via maiacc
  3. run validation suites
  4. commit the regenerated output

Main Structure

  • assembler/: assembler, generated parser, and tests
  • grammar/: EBNF grammars (including WAT)
  • maiacc/: parser-generator submodule (tREx)
  • docs/: architecture and evolution docs

Requirements

  • Node.js 18+
  • Git with submodule support

Setup

Clone with submodules:

git clone --recurse-submodules https://github.com/souzamonteiro/maiawasm.git
cd maiawasm

If you already cloned without submodules:

git submodule update --init --recursive

Quick Usage

Assemble a fixture:

node assembler/wat-assembler.js assembler/tests/fixtures/01-basic-module.wat -o test.wasm

Optional validation (if wabt is installed):

wasm-validate test.wasm

CLI Scripts (Run From Anywhere)

The repository includes shell wrappers in bin/ that resolve internal paths automatically, so they can be called from any current directory.

# WAT -> WASM
/absolute/path/to/maiawasm/bin/wat2wasm.sh input.wat output.wasm

# WASM -> WAT
/absolute/path/to/maiawasm/bin/wasm2wat.sh input.wasm output.wat

# Roundtrip: WAT -> WASM -> WAT -> WASM (+ validation)
/absolute/path/to/maiawasm/bin/roundtrip.sh input.wat [output-dir]

# Link plan + JS loader generation for multiple WASM modules
/absolute/path/to/maiawasm/bin/wasm-link.sh moduleA.wasm moduleB.wasm [options]

If output is omitted, the script writes alongside the input file using the matching extension.

Examples:

/absolute/path/to/maiawasm/bin/wat2wasm.sh ./module.wat
/absolute/path/to/maiawasm/bin/wasm2wat.sh ./module.wasm
/absolute/path/to/maiawasm/bin/roundtrip.sh ./module.wat
/absolute/path/to/maiawasm/bin/wasm-link.sh ./app.wasm ./libmath.wasm -o ./linked-loader.js

Useful options for wasm-link.sh:

# Fails if there are unresolved imports
/absolute/path/to/maiawasm/bin/wasm-link.sh ./app.wasm ./libmath.wasm --strict

# Validates disassembler -> assembler roundtrip during analysis
/absolute/path/to/maiawasm/bin/wasm-link.sh ./app.wasm ./libmath.wasm --validate-roundtrip

# Static link (partial: functions + local/imported memory/table/global + elem/data segments) to a single WASM
/absolute/path/to/maiawasm/bin/wasm-link.sh ./app.wasm ./libmath.wasm --static --wasm-output ./linked.wasm -e app

Testes

Main assembler suite:

node assembler/test-assembler.js

Proposal suite:

node assembler/test-assembler-proposals.js

Internal fixtures suite:

node assembler/tests/run-tests.js

Static linker regression matrix (local sections + available multi-module fixtures):

npm run test:linker:static

Regenerating the WAT Parser (Canonical Flow)

Whenever grammar/WAT.ebnf changes, regenerate assembler/wat-parser.js via maiacc:

bash ./maiacc/bin/tREx.sh --ebnf --to-xml assembler/_wat-grammar.xml ./grammar/WAT.ebnf ./assembler/wat-parser.js

Optionally remove the temporary XML after regeneration:

rm -f assembler/_wat-grammar.xml

Contribution Best Practices

  • do not manually edit assembler/wat-parser.js for grammar rule changes
  • prefer changes in grammar/WAT.ebnf and/or the generator in maiacc
  • run suite validation before committing
  • keep commits small with clear messages

Related Documentation

  • docs/ARCHITECTURE.md
  • assembler/README.md
  • docs/WEBASSEMBLER_COM_REX_WATJS.md
  • maiacc/README.md

License

This project is distributed under the license defined in LICENSE.