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: 14 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 (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-13T13:09:44.000Z (over 5 years ago)
- Last Synced: 2025-04-04T13:52:46.797Z (3 months ago)
- Topics: dfa, lalr1, lr0, lr1, python, python3, slr1
- Language: Python
- Homepage:
- Size: 325 KB
- Stars: 9
- 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:
_dfa.png)#### LR(1) DFA
- Sample LR(1) grammer
```
E->(L,E)|F
L->L,E|E
F->(F)|d
```
- Sample-generated DFA:
_dfa.png)### Simple Calculator
File folder `calculator` contains a python calculator based on LR parsing.