Maude (the term rewriting system) compiled to WebAssembly, with a TypeScript wrapper for Node and the browser.
packages/core— cross-compiles Maude 3.5 (+ GMP, BuDDy) with Emscripten into an ES module with the prelude embedded.packages/maude— TypeScript wrapper: rawrunMaudeplus a structuredMaudesession API.packages/demo— interactive Maude tutorial (Vite + React, MDX chapters with runnable snippets, executed in a Web Worker).
mise install # pinned toolchain: node, pnpm, emsdk, cmake
pnpm installpnpm dev # mprocs: demo dev server (localhost:5173) + wrapper tsc --watchpnpm build
pnpm testThe first build compiles GMP, BuDDy, and Maude from source and takes a
while; afterwards the wasm step is skipped
(pnpm --filter @maude-wasm/core rebuild-wasm forces it). See
packages/core/scripts/build.sh for the porting details.
import { runMaude, Maude } from "maude-wasm";
const { stdout } = await runMaude("reduce in NAT : 1 + 2 .");
const m = new Maude();
await m.load(`mod VENDING is ... endm`);
await m.search("$ q q q", "apple cake M:Marking", { arrow: "=>!" });
// { solutions: [{ state: 4, substitution: { "M:Marking": "null" } }], complete: true }The Maude class also provides reduce, rewrite, frewrite,
erewrite, srewrite, match, unify, variantUnify, variants,
vuNarrow, modelCheck, parse, show, and a raw exec escape
hatch — answers are parsed into data. MaudeWorkerSession offers the
same API against one persistent interpreter (fast for long sessions;
needs SharedArrayBuffer). In the browser, run Maude in a Web Worker
and pass locateFile for the wasm URL (see packages/demo for the
pattern, including cancellation).
Not available in the wasm build: SMT, external objects (sockets, processes), and the interactive debugger.