An open API service indexing awesome lists of open source software.

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

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.