https://github.com/chalarangelo/cfg-parser
Context free grammar parser based on Earley parsing
https://github.com/chalarangelo/cfg-parser
context-free-grammar earley-parser parser
Last synced: 3 months ago
JSON representation
Context free grammar parser based on Earley parsing
- Host: GitHub
- URL: https://github.com/chalarangelo/cfg-parser
- Owner: Chalarangelo
- License: mit
- Created: 2025-02-16T09:53:47.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-02-23T12:19:24.000Z (8 months ago)
- Last Synced: 2025-02-23T12:19:38.671Z (8 months ago)
- Topics: context-free-grammar, earley-parser, parser
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cfg-parser
Context free grammar parser based on Earley parsing## How to use
Allow the `console` script to be executed:
```sh
chmod +x ./bin/console./bin/console
```In the `console`, you can use the following commands:
- `tokenize()`: Tokenize the input string using the grammar defined in the loaded grammar.
- `parse()`: Parse the input string using the grammar defined in the loaded grammar.
- `evaluate()`: Evaluate the input string using the grammar defined in the loaded grammar.The default grammar is defined in `./src/samples/math.js`. You can define your own an export it from a file, then import it in the `console` and use it.