Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yanhuijessica/syntax-analysis
LR(0)/SLR(1)/LR(1)/LALR(1), syntax analysis, simple calculator
https://github.com/yanhuijessica/syntax-analysis
dfa lalr1 lr0 lr1 python python3 slr1
Last synced: 17 days ago
JSON representation
LR(0)/SLR(1)/LR(1)/LALR(1), syntax analysis, simple calculator
- Host: GitHub
- URL: https://github.com/yanhuijessica/syntax-analysis
- Owner: YanhuiJessica
- Created: 2020-01-22T14:57:05.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-13T13:09:44.000Z (almost 5 years ago)
- Last Synced: 2024-10-29T15:51:35.611Z (2 months ago)
- Topics: dfa, lalr1, lr0, lr1, python, python3, slr1
- Language: Python
- Homepage:
- Size: 325 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Syntax-Analysis
### Overview
- Can construct and display LR(0) DFA and LR(1) DFA
- Can judge the grammer
- Can construct LR(0)/SLR(1)/LR(1)/LALR(1) ACTION/GOTO tables
- Can judge whether the sentence is generated by the given grammar### Requirements
- Python 3
- python-graphviz
- Users can install it by running `pip install graphviz`### DFA Sample Generation
#### LR(0) DFA
- Sample LR(0) grammer
```bash
E->E+T|T
T->(E)|d
# should not have new line at the end of the file
```
- Sample-generated DFA:
![sample LR(0) DFA](img/sample_LR(0)_dfa.png)#### LR(1) DFA
- Sample LR(1) grammer
```
E->(L,E)|F
L->L,E|E
F->(F)|d
```
- Sample-generated DFA:
![sample LR(1) DFA](img/sample_LR(1)_dfa.png)### Simple Calculator
File folder `calculator` contains a python calculator based on LR parsing.