Parser generator for the lezer incremental parser
  • TypeScript 97.9%
  • JavaScript 2.1%
Find a file
2026-04-16 19:15:24 +02:00
dist Add type declarations for the rollup plugin 2024-01-28 18:49:11 +01:00
src Add support for @conflict markers for external token sets 2025-06-23 18:44:00 +02:00
test Add a test case for issue 68 2026-04-16 19:15:24 +02:00
.gitignore Use buildtool to build the library 2023-08-17 16:24:13 +02:00
.mocharc.cjs Rename to @lezer/generator, upgrade deps 2021-08-03 16:14:14 +02:00
.npmignore Add an .npmignore that doesn't omit dist/ 2019-07-09 20:35:49 +02:00
build.js Fix library import in ES version of Rollup plugin 2023-08-20 10:23:55 +02:00
CHANGELOG.md Mark version 1.8.0 2025-06-23 18:50:15 +02:00
LICENSE Update maintainer email 2023-01-24 08:28:47 +01:00
package.json Update github links 2026-04-14 17:24:26 +02:00
README.md Update github links 2026-04-14 17:24:26 +02:00
tsconfig.json Rename to @lezer/generator, upgrade deps 2021-08-03 16:14:14 +02:00

@lezer/generator

[ WEBSITE | ISSUES | FORUM | CHANGELOG ]

This is an LR(1) (more precisely pseudo-LALR,with opt-in GLR) parser generator which outputs grammars that can be used by the Lezer parser.

This package exports both a command-line parser generator tool called lezer-generator and a programming interface.

The grammar format that the tool accepts is documented in the system guide.

See test/cases/ for some simple example grammars, or lezer-javascript for a real grammar.

You can import "@lezer/generator/rollup" to get a Rollup plugin that will transform files ending in .grammar or .grammar.terms (a pseudo-source referring to the terms produced by the .grammar file) as part of the rollup build process.

import {lezer} from "@lezer/generator/rollup"

export default {
  input: "./in.js",
  output: {file: "out.js", format: "cjs"},
  plugins: [lezer()]
}

The plugin can be passed lezer({exportName}) option to configure the name of the parser export.

The code is licensed under an MIT license.