ebnf-parser is a utility library designed to parse BNF and EBNF grammars, primarily used as a pre-processor for the Jison parser generator. It takes either a string representation of a grammar or a JSON grammar and transforms EBNF constructs into standard BNF, producing a JSON grammar format that Jison can consume. The current stable version is 0.1.10. Due to its specific role as a dependency for Jison and its low version number, its release cadence is slow and driven by Jison's needs. Key differentiators include its tight integration with Jison's grammar format and its focus solely on grammar transformation rather than full parsing engine capabilities, making it a specialized tool in the parser generator ecosystem.
npm install ebnf-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `ebnf-parser` to parse a string-based EBNF grammar and how to conceptually transform an EBNF JSON grammar into a Jison-compatible BNF JSON format.
Use `const ebnfParser = require('ebnf-parser');` for CommonJS environments. For ESM, a dynamic import `import('ebnf-parser')` might work, or configure your bundler (e.g., Webpack, Rollup) to handle CommonJS modules.After cloning the repository, navigate to the package directory and run `make`. If installing via npm, this step is typically handled by `prepare` scripts, but manual builds might require it.
Evaluate whether its features meet your needs and consider the stability implications for long-term projects. Report issues on the GitHub repository if you encounter bugs.
If installing from source (e.g., Git clone), ensure you run `make` in the package root to generate `parser.js`. If installed via npm, verify the installation integrity.
Change your import statement to `const ebnfParser = require('ebnf-parser');`. Alternatively, configure your project for ESM, but note that `ebnf-parser` itself is CommonJS and will require interop.No dependency data recorded yet.