Hyperlark is a Rust reimplementation of the Lark parsing toolkit, compiled to WebAssembly, with a JS/TS interface.
Hyperlark can parse all context-free languages. To put it simply, it means that it is capable of parsing almost any programming language out there, and to some degree most natural languages too.
Hyperlark is competitive in speed with the fastest JS parsers, and provides a lot more features and parsing power. Hyperlark also provides interfaces for Python, Rust and C.
Status: 0.1.0-beta.1 — pre-1.0, APIs may still change between betas.
npm install hyperlark@beta
(hyperlark is still in beta, so use the beta dist-tag and not latest)
Runs on Node ≥ 20 and in the browser, bundlers, Deno, Bun and edge.
We currently offer 3 entrypoints:
| Entry | Loads the wasm | Compiles .lark source |
|---|---|---|
hyperlark |
synchronously (Node only) | yes |
hyperlark/web |
asynchronously, via await init() |
yes |
hyperlark/slim |
synchronously (Node only) | no — Lark.fromJSON only |
slim drops the grammar compiler, the heaviest component in the module, for a
noticeably smaller download; it can only load a grammar compiled ahead of time.
Not supported: threads. The binding is single-threaded by design.
import { Lark, pretty } from "hyperlark";
const parser = new Lark(`
start: WORD+
%import common.WORD
%ignore " "
`);
const tree = parser.parse("hello world");
console.log(pretty(tree));
In a browser, a bundler, Deno or an edge runtime, import hyperlark/web and
await init() once before the first parse. Everything after that is identical:
import init from "hyperlark/web";
const { Lark } = await init(); // idempotent; auto-fetches the .wasm
const tree = new Lark(grammar).parse("hello world");
For complete, runnable programs — a calculator, JSON streaming, ambiguity, interactive parsing — see the examples page.
.lark files get syntax
highlighting on GitHub.postlex pass, such as the bundled Indenter, covers
indentation-sensitive languages.Transformer / Visitor /
Interpreter classes on the parse tree, or pass a transformer to
parse(text, { transformer }) to skip tree construction entirely.propagate_positions: true..d.ts; trees, tokens, errors
and options are all typed, and a transformer's fold result is inferred.Hyperlark is in the same class as the fastest JS parser libraries, like peggy and chevrotain.
Actual speed depends on grammar, input size and how Hyperlark is used.
For more information, see the benchmarks.
Hyperlark's source hasn't been published at this time.
Free for noncommercial use, including evaluation and testing inside commercial organizations. Commercial use requires a separate license — contact [email protected].
Copyright © 2026 Esh Software LLC. Full text in the LICENSE file in the
package.