https://github.com/kingcitaldo125/cppearley
Earley parser in C++
https://github.com/kingcitaldo125/cppearley
context-free-grammar cpp11 earley-parser parser
Last synced: about 2 months ago
JSON representation
Earley parser in C++
- Host: GitHub
- URL: https://github.com/kingcitaldo125/cppearley
- Owner: Kingcitaldo125
- License: apache-2.0
- Created: 2021-05-25T20:52:32.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-07-13T20:52:51.000Z (about 3 years ago)
- Last Synced: 2025-07-26T11:24:21.887Z (2 months ago)
- Topics: context-free-grammar, cpp11, earley-parser, parser
- Language: C++
- Homepage:
- Size: 43.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CppEarley
Basic C++ Earley Parser, based heavily on the [Earley parser](https://en.wikipedia.org/wiki/Earley_parser) article found on Wikipedia.
This is meant to be a very simplistic implementation of the Earley algorithm and pseudocode found in that article.## Requirements
- [Google Test](https://github.com/google/googletest) for unit tests
## Usage
### Linux
Either `git clone https://github.com/Kingcitaldo125/CppEarley.git` to a directory of your choice, or retrieve the source code from a release of your choice.
To build using CMake:
``` bash
mkdir build
cd build
cmake ..
make
```To run using the basic Earley grammar found in the Wikipedia article:
``` bash
./main ../grammars/grammar.txt
```The output from pointing the main target to the basic Earley grammar should be similar to the following:
``` bash
../grammars/grammar.txt
Input <1> = true
Input <1+> = false
Input <1+2> = true
Input <2+3*4> = true
```### Windows
Coming Soon - Windows is still in `Dev`.
## License
See the [LICENSE](https://github.com/Kingcitaldo125/CppEarley/blob/main/LICENSE) file for details