https://github.com/krishnazawar/cfgvalidator
CFG validation using CLR parsing technique.
https://github.com/krishnazawar/cfgvalidator
cfg compiler-design cpp parsers
Last synced: about 1 year ago
JSON representation
CFG validation using CLR parsing technique.
- Host: GitHub
- URL: https://github.com/krishnazawar/cfgvalidator
- Owner: krishnaZawar
- Created: 2025-06-21T04:57:27.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-06-21T05:13:36.000Z (about 1 year ago)
- Last Synced: 2025-06-21T06:21:03.931Z (about 1 year ago)
- Topics: cfg, compiler-design, cpp, parsers
- Language: C++
- Homepage:
- Size: 200 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#
CFG validator
This a handwritten CLR parser to validate CFG syntax.
CFG (Context Free Grammar) is an essential representation tool used while working on compilers.
This parser validates whether the structure followed for writing CFG has been followed.
# How to Use
To validate your grammar, follow these simple steps:
1. write your program and save it in "testFile.txt" provided.
2. Run the main file
# Expected File Structure
```
Tokens : < token names separated by commas, this is optional>.
productionHead1 : productionBody1;
productionHead2 : productionBody2;
.
.
```
## examples
example 1:
CFG to validate inputs like {'a', 'aa', 'aaa', ... , 'aaa.....'}.
```
Tokens: .
A : 'a' A;
A : 'a';
```
example 2:
CFG to validate assignment statement
```
Tokens : identifier, number.
Start : AssignmentStatement;
AssignmentStatement : identifier '=' Value ';' ;
Value : identifier;
Value : number;
```
# Future scope of Development
1. Validate the semantics of the written CFG.
2. Allow the user to validate the input expected by his CFG.