Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/candh/compiler-toolkit
useful programs for syntax analysis
https://github.com/candh/compiler-toolkit
compiler-design compiler-toolset first-set syntax-analysis
Last synced: about 1 month ago
JSON representation
useful programs for syntax analysis
- Host: GitHub
- URL: https://github.com/candh/compiler-toolkit
- Owner: candh
- License: mit
- Created: 2020-08-22T21:58:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-08-23T15:52:08.000Z (over 4 years ago)
- Last Synced: 2024-11-07T03:49:27.961Z (about 2 months ago)
- Topics: compiler-design, compiler-toolset, first-set, syntax-analysis
- Language: Python
- Homepage:
- Size: 370 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## compiler-toolkit
Collection of programs useful for syntax analysis.
![screenshot of the tool](screenshot.png)---
```bash
$ pip install compilertk
$ compilertk FILE
```
---Features:
- Elimination of Null Productions
- Elimination of Unit Productions
- Elimination of Left Recursion
- Calculates First Sets
- Calculates Follow Sets
- Prints Parsing Table
- Generates a log file## Notation
Using this example of a grammar:
```
S -> S a A | B
A -> a A | eps
B -> d E'
E' -> int a | eps
```- Every symbol on the left side is a non-terminal
- Non-terminals and its productions are separated by "->"
- Individual symbols are separated with a **space**.
- Null productions are specified with **eps**
- **|** is used to specify alternative productions## Tests
Make sure everything runs fine by running the test cases
1. `./run_tests.sh`
## TODOs
- Add docstrings to functions
- Add test cases for parsing table
- Add more tests cases## Useful Links
- https://mikedevice.github.io/first-follow/
- http://hackingoff.com/compilers
- http://hackingoff.com/compilers/predict-first-follow-set (unreliable)