E->E+T|T,T->(E)|a的LR(0)分析表
时间: 2024-04-07 07:30:41 浏览: 105
LR(0)分析表包括状态、文法符号、动作以及转移。
状态:
| 状态 | 项目集 |
| --- | --- |
| I0 | {E'->.E} |
| I1 | {E'->E., $} |
| I2 | {E->.E+T, E->.T, T->.(E), T->.a} |
| I3 | {E->E+.T} |
| I4 | {E->T.} |
| I5 | {T->(.E), T->.a} |
| I6 | {E->E+.T, T->. (E), T->.a} |
| I7 | {E->T+T.} |
| I8 | {T->(E.)} |
| I9 | {E->E+.T, T->.(E), T->.a} |
| I10 | {T->E.)} |
文法符号:
| 状态 | a | + | ( | ) | $ |
| --- | --- | --- | --- | --- | --- |
| I0 | S2 | | S4 | | |
| I1 | | | | | Acc |
| I2 | S5 | S6 | S4 | | |
| I3 | S5 | S6 | | | |
| I4 | | | | | R2 |
| I5 | S5 | | S4 | | |
| I6 | S5 | S6 | S4 | | |
| I7 | | S6 | | R4 | R4 |
| I8 | S5 | | S4 | | |
| I9 | S5 | S6 | | R1 | R1 |
| I10 | | S6 | | R3 | R3 |
动作:
| 状态 | a | + | ( | ) | $ |
| --- | --- | --- | --- | --- | --- |
| I0 | S2 | | S4 | | |
| I1 | | | | | Acc |
| I2 | S5 | S6 | S4 | | |
| I3 | S5 | S6 | | | |
| I4 | | | | | R2 |
| I5 | S5 | | S4 | | |
| I6 | S5 | S6 | S4 | | |
| I7 | | S6 | | R4 | R4 |
| I8 | S5 | | S4 | | |
| I9 | S5 | S6 | | R1 | R1 |
| I10 | | S6 | | R3 | R3 |
转移:
| 状态 | E | T |
| --- | --- | --- |
| I0 | S1 | S3 |
| I2 | S1 | S3 |
| I3 | | S7 |
| I6 | | S8 |
| I9 | | S10 |
阅读全文