BGEX (Better Grammar EXtractor) is a language and compiler for defining and generating context-free grammar parsers. v0.0.26 compiles BGEX source into TypeScript parsers that export typed AST nodes. It relies on TypeScript >=5.0 as a peer dependency. Differentiators include native ESM, full TypeScript support, and lightweight output with no runtime dependencies.
npm install bgex-compilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to define a simple arithmetic grammar and parse an input string into an AST using BGEX.
Update to use const parser = compile(grammar); const ast = parser.parse(input);
Convert input to LF before passing to compile().
Use compile(grammar) instead of compile({ grammar }).Recompile grammar in each worker.
Use import { compile } from 'bgex-compiler' instead of import compile from 'bgex-compiler'.Trim input and replace \r\n with \n before passing to compile().
Ensure tsconfig.json has 'moduleResolution': 'node16' or 'bundler' and 'module': 'ESNext'.
Set package.json type: 'module' or use dynamic import().