标签:解析器 Additive -- 一键 Primary number -.- Multiplicative Calc
Compiler of Calc
The C# source code of the compiler Calc
is generated by bitzhuwei.GrammarFormat
.
Grammar
// 8 VnRegulations:
Additive : Additive '+' Multiplicative // [0]
| Additive '-' Multiplicative // [1]
| Multiplicative ; // [2]
Multiplicative : Multiplicative '*' Primary // [3]
| Multiplicative '/' Primary // [4]
| Primary ; // [5]
Primary : '(' Additive ')' // [6]
| 'number' ; // [7]
// 1 VtPatterns:
'number' : %%[0-9]+%% ; // [0]
Lexical Analyzer States
flowchart
classDef c0001 color:#FF0000;
classDef c0010 stroke-dasharray: 10 10;
classDef c0011 stroke-dasharray: 10 10,color:#FF0000;
classDef c0100 fill:#BB66EE;
classDef c0101 fill:#BB66EE,color:#FF0000;
classDef c0110 fill:#BB66EE,stroke-dasharray: 10 10;
classDef c0111 fill:#BB66EE,stroke-dasharray: 10 10,color:#FF0000;
classDef c1000 stroke:#333,stroke-width:4px;
classDef c1001 stroke:#333,stroke-width:4px,color:#FF0000;
classDef c1010 stroke:#333,stroke-width:4px,stroke-dasharray: 10 10;
classDef c1011 stroke:#333,stroke-width:4px,stroke-dasharray: 10 10,color:#FF0000;
classDef c1100 stroke:#333,stroke-width:4px,fill:#BB66EE;
classDef c1101 stroke:#333,stroke-width:4px,fill:#BB66EE,color:#FF0000;
classDef c1110 stroke:#333,stroke-width:4px,fill:#BB66EE,stroke-dasharray: 10 10;
classDef c1111 stroke:#333,stroke-width:4px,fill:#BB66EE,stroke-dasharray: 10 10,color:#FF0000;
DFA0_1371898302{{"DFA0 wholeStart"}}
class DFA0_1371898302 c1000;
DFA1_736285203[\"DFA1 {1}"/]
class DFA1_736285203 c0101;
DFA2_24116860[\"DFA2 {1}"/]
class DFA2_24116860 c0101;
DFA3_1215392932[\"DFA3 {1}"/]
class DFA3_1215392932 c0101;
DFA4_-740876899[\"DFA4 {1}"/]
class DFA4_-740876899 c0101;
DFA5_-2132989191[\"DFA5 {1}"/]
class DFA5_-2132989191 c0101;
DFA6_-489194620[\"DFA6 {1}"/]
class DFA6_-489194620 c0101;
DFA7_431494236[\"DFA7 {1}"/]
class DFA7_431494236 c0101;
DFA0_1371898302 -->|"[0-9]
BeginToken 'number'
ExtendToken 'number'"|DFA1_736285203
DFA0_1371898302 -->|"+
BeginToken '+'
ExtendToken '+'"|DFA2_24116860
DFA0_1371898302 -->|"-
BeginToken '-'
ExtendToken '-'"|DFA3_1215392932
DFA0_1371898302 -->|"*
BeginToken '*'
ExtendToken '*'"|DFA4_-740876899
DFA0_1371898302 -->|"/
BeginToken '/'
ExtendToken '/'"|DFA5_-2132989191
DFA0_1371898302 -->|"(
BeginToken '('
ExtendToken '('"|DFA6_-489194620
DFA0_1371898302 -->|")
BeginToken ')'
ExtendToken ')'"|DFA7_431494236
DFA1_736285203 -->|"[0-9]
ExtendToken 'number'"|DFA1_736285203
nullable
nullalbe( Additive ) = False
nullalbe( '+' ) = False
nullalbe( Multiplicative ) = False
nullalbe( '-' ) = False
nullalbe( '*' ) = False
nullalbe( Primary ) = False
nullalbe( '/' ) = False
nullalbe( '(' ) = False
nullalbe( ')' ) = False
nullalbe( 'number' ) = False
nullalbe( ) = True
FIRST
[0]: FIRST( Additive ) = { '(' 'number' }
[1]: FIRST( Multiplicative ) = { '(' 'number' }
[2]: FIRST( Primary ) = { '(' 'number' }
[3]: FIRST( '+' ) = { '+' }
[4]: FIRST( '-' ) = { '-' }
[5]: FIRST( '*' ) = { '*' }
[6]: FIRST( '/' ) = { '/' }
[7]: FIRST( '(' ) = { '(' }
[8]: FIRST( ')' ) = { ')' }
[9]: FIRST( 'number' ) = { 'number' }
[10]: FIRST( ) = { empty }
[11]: FIRST( Additive '+' Multiplicative ) = { '(' 'number' }
[12]: FIRST( Additive '-' Multiplicative ) = { '(' 'number' }
[13]: FIRST( Multiplicative '*' Primary ) = { '(' 'number' }
[14]: FIRST( Multiplicative '/' Primary ) = { '(' 'number' }
[15]: FIRST( '(' Additive ')' ) = { '(' }
FOLLOW
[0]: FOLLOW( Additive ) = { '+' '-' ')' }
[1]: FOLLOW( Multiplicative ) = { '+' '-' '*' '/' ')' }
[2]: FOLLOW( Primary ) = { '+' '-' '*' '/' ')' }
LL(1) Syntax Machine
状态 |
'+' |
'-' |
'*' |
'/' |
'(' |
')' |
'number' |
Additive |
|
|
|
|
R[0] R[1] R[2] |
|
R[0] R[1] R[2] |
Multiplicative |
|
|
|
|
R[3] R[4] R[5] |
|
R[3] R[4] R[5] |
Primary |
|
|
|
|
R[6] |
|
R[7] |
LR(0) Syntax Machine
状态 |
'+' |
'-' |
'*' |
'/' |
'(' |
')' |
'number' |
'¥' |
Additive |
Multiplicative |
Primary |
0 |
|
|
|
|
S4 |
|
S5 |
|
G1 |
G2 |
G3 |
1 |
S6 |
S7 |
|
|
|
|
|
完成 |
|
|
|
2 |
R[2] |
R[2] |
S8 R[2] |
S9 R[2] |
R[2] |
R[2] |
R[2] |
R[2] |
|
|
|
3 |
R[5] |
R[5] |
R[5] |
R[5] |
R[5] |
R[5] |
R[5] |
R[5] |
|
|
|
4 |
|
|
|
|
S4 |
|
S5 |
|
G10 |
G2 |
G3 |
5 |
R[7] |
R[7] |
R[7] |
R[7] |
R[7] |
R[7] |
R[7] |
R[7] |
|
|
|
6 |
|
|
|
|
S4 |
|
S5 |
|
|
G11 |
G3 |
7 |
|
|
|
|
S4 |
|
S5 |
|
|
G12 |
G3 |
8 |
|
|
|
|
S4 |
|
S5 |
|
|
|
G13 |
9 |
|
|
|
|
S4 |
|
S5 |
|
|
|
G14 |
10 |
S6 |
S7 |
|
|
|
S15 |
|
|
|
|
|
11 |
R[0] |
R[0] |
S8 R[0] |
S9 R[0] |
R[0] |
R[0] |
R[0] |
R[0] |
|
|
|
12 |
R[1] |
R[1] |
S8 R[1] |
S9 R[1] |
R[1] |
R[1] |
R[1] |
R[1] |
|
|
|
13 |
R[3] |
R[3] |
R[3] |
R[3] |
R[3] |
R[3] |
R[3] |
R[3] |
|
|
|
14 |
R[4] |
R[4] |
R[4] |
R[4] |
R[4] |
R[4] |
R[4] |
R[4] |
|
|
|
15 |
R[6] |
R[6] |
R[6] |
R[6] |
R[6] |
R[6] |
R[6] |
R[6] |
|
|
|
flowchart
classDef default fill:#C7EDCC,stroke:#993399,stroke-width:0px,text-align:left;
classDef titlebarStyle fill:gold;
titlebar>"LR(1) syntax states"]
class titlebar titlebarStyle
syntaxState0("syntaxState0
[-1] FinalValue> : ⏳ Additive ;
[0] Additive : ⏳ Additive '+' Multiplicative ;
[1] Additive : ⏳ Additive '-' Multiplicative ;
[2] Additive : ⏳ Multiplicative ;
[3] Multiplicative : ⏳ Multiplicative '*' Primary ;
[4] Multiplicative : ⏳ Multiplicative '/' Primary ;
[5] Multiplicative : ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState1("syntaxState1
[-1] FinalValue> : Additive ⏳ ;
[0] Additive : Additive ⏳ '+' Multiplicative ;
[1] Additive : Additive ⏳ '-' Multiplicative ; ")
syntaxState2("syntaxState2
[2] Additive : Multiplicative ⏳ ;
[3] Multiplicative : Multiplicative ⏳ '*' Primary ;
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ")
syntaxState3("syntaxState3
[5] Multiplicative : Primary ⏳ ; ")
syntaxState4("syntaxState4
[6] Primary : '(' ⏳ Additive ')' ;
[0] Additive : ⏳ Additive '+' Multiplicative ;
[1] Additive : ⏳ Additive '-' Multiplicative ;
[2] Additive : ⏳ Multiplicative ;
[3] Multiplicative : ⏳ Multiplicative '*' Primary ;
[4] Multiplicative : ⏳ Multiplicative '/' Primary ;
[5] Multiplicative : ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState5("syntaxState5
[7] Primary : 'number' ⏳ ; ")
syntaxState6("syntaxState6
[0] Additive : Additive '+' ⏳ Multiplicative ;
[3] Multiplicative : ⏳ Multiplicative '*' Primary ;
[4] Multiplicative : ⏳ Multiplicative '/' Primary ;
[5] Multiplicative : ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState7("syntaxState7
[1] Additive : Additive '-' ⏳ Multiplicative ;
[3] Multiplicative : ⏳ Multiplicative '*' Primary ;
[4] Multiplicative : ⏳ Multiplicative '/' Primary ;
[5] Multiplicative : ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState8("syntaxState8
[3] Multiplicative : Multiplicative '*' ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState9("syntaxState9
[4] Multiplicative : Multiplicative '/' ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState10("syntaxState10
[6] Primary : '(' Additive ⏳ ')' ;
[0] Additive : Additive ⏳ '+' Multiplicative ;
[1] Additive : Additive ⏳ '-' Multiplicative ; ")
syntaxState11("syntaxState11
[0] Additive : Additive '+' Multiplicative ⏳ ;
[3] Multiplicative : Multiplicative ⏳ '*' Primary ;
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ")
syntaxState12("syntaxState12
[1] Additive : Additive '-' Multiplicative ⏳ ;
[3] Multiplicative : Multiplicative ⏳ '*' Primary ;
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ")
syntaxState13("syntaxState13
[3] Multiplicative : Multiplicative '*' Primary ⏳ ; ")
syntaxState14("syntaxState14
[4] Multiplicative : Multiplicative '/' Primary ⏳ ; ")
syntaxState15("syntaxState15
[6] Primary : '(' Additive ')' ⏳ ; ")
syntaxState0 -.-> |"Additive"| syntaxState1
syntaxState0 -.-> |"Multiplicative"| syntaxState2
syntaxState0 -.-> |"Primary"| syntaxState3
syntaxState0 --> |"'('"| syntaxState4
syntaxState0 --> |"'number'"| syntaxState5
syntaxState1 --> |"'+'"| syntaxState6
syntaxState1 --> |"'-'"| syntaxState7
syntaxState2 --> |"'*'"| syntaxState8
syntaxState2 --> |"'/'"| syntaxState9
syntaxState4 -.-> |"Additive"| syntaxState10
syntaxState4 -.-> |"Multiplicative"| syntaxState2
syntaxState4 -.-> |"Primary"| syntaxState3
syntaxState4 --> |"'('"| syntaxState4
syntaxState4 --> |"'number'"| syntaxState5
syntaxState6 -.-> |"Multiplicative"| syntaxState11
syntaxState6 -.-> |"Primary"| syntaxState3
syntaxState6 --> |"'('"| syntaxState4
syntaxState6 --> |"'number'"| syntaxState5
syntaxState7 -.-> |"Multiplicative"| syntaxState12
syntaxState7 -.-> |"Primary"| syntaxState3
syntaxState7 --> |"'('"| syntaxState4
syntaxState7 --> |"'number'"| syntaxState5
syntaxState8 -.-> |"Primary"| syntaxState13
syntaxState8 --> |"'('"| syntaxState4
syntaxState8 --> |"'number'"| syntaxState5
syntaxState9 -.-> |"Primary"| syntaxState14
syntaxState9 --> |"'('"| syntaxState4
syntaxState9 --> |"'number'"| syntaxState5
syntaxState10 --> |"')'"| syntaxState15
syntaxState10 --> |"'+'"| syntaxState6
syntaxState10 --> |"'-'"| syntaxState7
syntaxState11 --> |"'*'"| syntaxState8
syntaxState11 --> |"'/'"| syntaxState9
syntaxState12 --> |"'*'"| syntaxState8
syntaxState12 --> |"'/'"| syntaxState9
syntaxState1 o--o |"'¥'"| syntaxState1
syntaxState2 x==x |"'*' '/' '+' '-' '(' ')' 'number' '¥'
R[2]= Additive : Multiplicative ;"| syntaxState2
syntaxState11 x==x |"'*' '/' '+' '-' '(' ')' 'number' '¥'
R[0]= Additive : Additive '+' Multiplicative ;"| syntaxState11
syntaxState12 x==x |"'*' '/' '+' '-' '(' ')' 'number' '¥'
R[1]= Additive : Additive '-' Multiplicative ;"| syntaxState12
syntaxState3 x==x |"'+' '-' '*' '/' '(' ')' 'number' '¥'
R[5]= Multiplicative : Primary ;"| syntaxState3
syntaxState5 x==x |"'+' '-' '*' '/' '(' ')' 'number' '¥'
R[7]= Primary : 'number' ;"| syntaxState5
syntaxState13 x==x |"'+' '-' '*' '/' '(' ')' 'number' '¥'
R[3]= Multiplicative : Multiplicative '*' Primary ;"| syntaxState13
syntaxState14 x==x |"'+' '-' '*' '/' '(' ')' 'number' '¥'
R[4]= Multiplicative : Multiplicative '/' Primary ;"| syntaxState14
syntaxState15 x==x |"'+' '-' '*' '/' '(' ')' 'number' '¥'
R[6]= Primary : '(' Additive ')' ;"| syntaxState15
SLR(1) Syntax Machine
状态 |
'+' |
'-' |
'*' |
'/' |
'(' |
')' |
'number' |
'¥' |
Additive |
Multiplicative |
Primary |
0 |
|
|
|
|
S4 |
|
S5 |
|
G1 |
G2 |
G3 |
1 |
S6 |
S7 |
|
|
|
|
|
完成 |
|
|
|
2 |
R[2] |
R[2] |
S8 |
S9 |
|
R[2] |
|
R[2] |
|
|
|
3 |
R[5] |
R[5] |
R[5] |
R[5] |
|
R[5] |
|
|
|
|
|
4 |
|
|
|
|
S4 |
|
S5 |
|
G10 |
G2 |
G3 |
5 |
R[7] |
R[7] |
R[7] |
R[7] |
|
R[7] |
|
|
|
|
|
6 |
|
|
|
|
S4 |
|
S5 |
|
|
G11 |
G3 |
7 |
|
|
|
|
S4 |
|
S5 |
|
|
G12 |
G3 |
8 |
|
|
|
|
S4 |
|
S5 |
|
|
|
G13 |
9 |
|
|
|
|
S4 |
|
S5 |
|
|
|
G14 |
10 |
S6 |
S7 |
|
|
|
S15 |
|
|
|
|
|
11 |
R[0] |
R[0] |
S8 |
S9 |
|
R[0] |
|
R[0] |
|
|
|
12 |
R[1] |
R[1] |
S8 |
S9 |
|
R[1] |
|
R[1] |
|
|
|
13 |
R[3] |
R[3] |
R[3] |
R[3] |
|
R[3] |
|
|
|
|
|
14 |
R[4] |
R[4] |
R[4] |
R[4] |
|
R[4] |
|
|
|
|
|
15 |
R[6] |
R[6] |
R[6] |
R[6] |
|
R[6] |
|
|
|
|
|
flowchart
classDef default fill:#C7EDCC,stroke:#993399,stroke-width:0px,text-align:left;
classDef titlebarStyle fill:gold;
titlebar>"LR(1) syntax states"]
class titlebar titlebarStyle
syntaxState0("syntaxState0
[-1] FinalValue> : ⏳ Additive ;
[0] Additive : ⏳ Additive '+' Multiplicative ;
[1] Additive : ⏳ Additive '-' Multiplicative ;
[2] Additive : ⏳ Multiplicative ;
[3] Multiplicative : ⏳ Multiplicative '*' Primary ;
[4] Multiplicative : ⏳ Multiplicative '/' Primary ;
[5] Multiplicative : ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState1("syntaxState1
[-1] FinalValue> : Additive ⏳ ;
[0] Additive : Additive ⏳ '+' Multiplicative ;
[1] Additive : Additive ⏳ '-' Multiplicative ; ")
syntaxState2("syntaxState2
[2] Additive : Multiplicative ⏳ ;
[3] Multiplicative : Multiplicative ⏳ '*' Primary ;
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ")
syntaxState3("syntaxState3
[5] Multiplicative : Primary ⏳ ; ")
syntaxState4("syntaxState4
[6] Primary : '(' ⏳ Additive ')' ;
[0] Additive : ⏳ Additive '+' Multiplicative ;
[1] Additive : ⏳ Additive '-' Multiplicative ;
[2] Additive : ⏳ Multiplicative ;
[3] Multiplicative : ⏳ Multiplicative '*' Primary ;
[4] Multiplicative : ⏳ Multiplicative '/' Primary ;
[5] Multiplicative : ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState5("syntaxState5
[7] Primary : 'number' ⏳ ; ")
syntaxState6("syntaxState6
[0] Additive : Additive '+' ⏳ Multiplicative ;
[3] Multiplicative : ⏳ Multiplicative '*' Primary ;
[4] Multiplicative : ⏳ Multiplicative '/' Primary ;
[5] Multiplicative : ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState7("syntaxState7
[1] Additive : Additive '-' ⏳ Multiplicative ;
[3] Multiplicative : ⏳ Multiplicative '*' Primary ;
[4] Multiplicative : ⏳ Multiplicative '/' Primary ;
[5] Multiplicative : ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState8("syntaxState8
[3] Multiplicative : Multiplicative '*' ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState9("syntaxState9
[4] Multiplicative : Multiplicative '/' ⏳ Primary ;
[6] Primary : ⏳ '(' Additive ')' ;
[7] Primary : ⏳ 'number' ; ")
syntaxState10("syntaxState10
[6] Primary : '(' Additive ⏳ ')' ;
[0] Additive : Additive ⏳ '+' Multiplicative ;
[1] Additive : Additive ⏳ '-' Multiplicative ; ")
syntaxState11("syntaxState11
[0] Additive : Additive '+' Multiplicative ⏳ ;
[3] Multiplicative : Multiplicative ⏳ '*' Primary ;
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ")
syntaxState12("syntaxState12
[1] Additive : Additive '-' Multiplicative ⏳ ;
[3] Multiplicative : Multiplicative ⏳ '*' Primary ;
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ")
syntaxState13("syntaxState13
[3] Multiplicative : Multiplicative '*' Primary ⏳ ; ")
syntaxState14("syntaxState14
[4] Multiplicative : Multiplicative '/' Primary ⏳ ; ")
syntaxState15("syntaxState15
[6] Primary : '(' Additive ')' ⏳ ; ")
syntaxState0 -.-> |"Additive"| syntaxState1
syntaxState0 -.-> |"Multiplicative"| syntaxState2
syntaxState0 -.-> |"Primary"| syntaxState3
syntaxState0 --> |"'('"| syntaxState4
syntaxState0 --> |"'number'"| syntaxState5
syntaxState1 --> |"'+'"| syntaxState6
syntaxState1 --> |"'-'"| syntaxState7
syntaxState2 --> |"'*'"| syntaxState8
syntaxState2 --> |"'/'"| syntaxState9
syntaxState4 -.-> |"Additive"| syntaxState10
syntaxState4 -.-> |"Multiplicative"| syntaxState2
syntaxState4 -.-> |"Primary"| syntaxState3
syntaxState4 --> |"'('"| syntaxState4
syntaxState4 --> |"'number'"| syntaxState5
syntaxState6 -.-> |"Multiplicative"| syntaxState11
syntaxState6 -.-> |"Primary"| syntaxState3
syntaxState6 --> |"'('"| syntaxState4
syntaxState6 --> |"'number'"| syntaxState5
syntaxState7 -.-> |"Multiplicative"| syntaxState12
syntaxState7 -.-> |"Primary"| syntaxState3
syntaxState7 --> |"'('"| syntaxState4
syntaxState7 --> |"'number'"| syntaxState5
syntaxState8 -.-> |"Primary"| syntaxState13
syntaxState8 --> |"'('"| syntaxState4
syntaxState8 --> |"'number'"| syntaxState5
syntaxState9 -.-> |"Primary"| syntaxState14
syntaxState9 --> |"'('"| syntaxState4
syntaxState9 --> |"'number'"| syntaxState5
syntaxState10 --> |"')'"| syntaxState15
syntaxState10 --> |"'+'"| syntaxState6
syntaxState10 --> |"'-'"| syntaxState7
syntaxState11 --> |"'*'"| syntaxState8
syntaxState11 --> |"'/'"| syntaxState9
syntaxState12 --> |"'*'"| syntaxState8
syntaxState12 --> |"'/'"| syntaxState9
syntaxState1 o--o |"'¥'"| syntaxState1
syntaxState2 x==x |"'+' '-' ')' '¥'
R[2]= Additive : Multiplicative ;"| syntaxState2
syntaxState3 x==x |"'+' '-' '*' '/' ')'
R[5]= Multiplicative : Primary ;"| syntaxState3
syntaxState5 x==x |"'+' '-' '*' '/' ')'
R[7]= Primary : 'number' ;"| syntaxState5
syntaxState11 x==x |"'+' '-' ')' '¥'
R[0]= Additive : Additive '+' Multiplicative ;"| syntaxState11
syntaxState12 x==x |"'+' '-' ')' '¥'
R[1]= Additive : Additive '-' Multiplicative ;"| syntaxState12
syntaxState13 x==x |"'+' '-' '*' '/' ')'
R[3]= Multiplicative : Multiplicative '*' Primary ;"| syntaxState13
syntaxState14 x==x |"'+' '-' '*' '/' ')'
R[4]= Multiplicative : Multiplicative '/' Primary ;"| syntaxState14
syntaxState15 x==x |"'+' '-' '*' '/' ')'
R[6]= Primary : '(' Additive ')' ;"| syntaxState15
LALR(1) Syntax Machine
状态 |
'+' |
'-' |
'*' |
'/' |
'(' |
')' |
'number' |
'¥' |
Additive |
Multiplicative |
Primary |
0 |
|
|
|
|
S4 |
|
S5 |
|
G1 |
G2 |
G3 |
1 |
S6 |
S7 |
|
|
|
|
|
完成 |
|
|
|
2 |
R[2] |
R[2] |
S8 |
S9 |
|
R[2] |
|
R[2] |
|
|
|
3 |
R[5] |
R[5] |
R[5] |
R[5] |
|
R[5] |
|
R[5] |
|
|
|
4 |
|
|
|
|
S4 |
|
S5 |
|
G10 |
G2 |
G3 |
5 |
R[7] |
R[7] |
R[7] |
R[7] |
|
R[7] |
|
R[7] |
|
|
|
6 |
|
|
|
|
S4 |
|
S5 |
|
|
G11 |
G3 |
7 |
|
|
|
|
S4 |
|
S5 |
|
|
G12 |
G3 |
8 |
|
|
|
|
S4 |
|
S5 |
|
|
|
G13 |
9 |
|
|
|
|
S4 |
|
S5 |
|
|
|
G14 |
10 |
S6 |
S7 |
|
|
|
S15 |
|
|
|
|
|
11 |
R[0] |
R[0] |
S8 |
S9 |
|
R[0] |
|
R[0] |
|
|
|
12 |
R[1] |
R[1] |
S8 |
S9 |
|
R[1] |
|
R[1] |
|
|
|
13 |
R[3] |
R[3] |
R[3] |
R[3] |
|
R[3] |
|
R[3] |
|
|
|
14 |
R[4] |
R[4] |
R[4] |
R[4] |
|
R[4] |
|
R[4] |
|
|
|
15 |
R[6] |
R[6] |
R[6] |
R[6] |
|
R[6] |
|
R[6] |
|
|
|
flowchart
classDef default fill:#C7EDCC,stroke:#993399,stroke-width:0px,text-align:left;
classDef titlebarStyle fill:gold;
titlebar>"LR(1) syntax states"]
class titlebar titlebarStyle
syntaxState0("syntaxState0
[-1] FinalValue> : ⏳ Additive ; '¥'
[0] Additive : ⏳ Additive '+' Multiplicative ; '¥' '+' '-'
[1] Additive : ⏳ Additive '-' Multiplicative ; '¥' '+' '-'
[2] Additive : ⏳ Multiplicative ; '¥' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; '¥' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; '¥' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; '¥' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ")
syntaxState1("syntaxState1
[-1] FinalValue> : Additive ⏳ ; '¥'
[0] Additive : Additive ⏳ '+' Multiplicative ; '¥' '+' '-'
[1] Additive : Additive ⏳ '-' Multiplicative ; '¥' '+' '-' ")
syntaxState2("syntaxState2
[2] Additive : Multiplicative ⏳ ; '¥' '+' '-' ')'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; '¥' '+' '-' '*' '/' ')'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; '¥' '+' '-' '*' '/' ')' ")
syntaxState3("syntaxState3
[5] Multiplicative : Primary ⏳ ; '¥' '+' '-' '*' '/' ')' ")
syntaxState4("syntaxState4
[6] Primary : '(' ⏳ Additive ')' ; '¥' '+' '-' '*' '/' ')'
[0] Additive : ⏳ Additive '+' Multiplicative ; ')' '+' '-'
[1] Additive : ⏳ Additive '-' Multiplicative ; ')' '+' '-'
[2] Additive : ⏳ Multiplicative ; ')' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; ')' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; ')' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; ')' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; ')' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; ')' '+' '-' '*' '/' ")
syntaxState5("syntaxState5
[7] Primary : 'number' ⏳ ; '¥' '+' '-' '*' '/' ')' ")
syntaxState6("syntaxState6
[0] Additive : Additive '+' ⏳ Multiplicative ; '¥' '+' '-' ')'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; '¥' '+' '-' '*' '/' ')'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; '¥' '+' '-' '*' '/' ')'
[5] Multiplicative : ⏳ Primary ; '¥' '+' '-' '*' '/' ')'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/' ')'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ')' ")
syntaxState7("syntaxState7
[1] Additive : Additive '-' ⏳ Multiplicative ; '¥' '+' '-' ')'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; '¥' '+' '-' '*' '/' ')'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; '¥' '+' '-' '*' '/' ')'
[5] Multiplicative : ⏳ Primary ; '¥' '+' '-' '*' '/' ')'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/' ')'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ')' ")
syntaxState8("syntaxState8
[3] Multiplicative : Multiplicative '*' ⏳ Primary ; '¥' '+' '-' '*' '/' ')'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/' ')'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ')' ")
syntaxState9("syntaxState9
[4] Multiplicative : Multiplicative '/' ⏳ Primary ; '¥' '+' '-' '*' '/' ')'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/' ')'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ')' ")
syntaxState10("syntaxState10
[6] Primary : '(' Additive ⏳ ')' ; '¥' '+' '-' '*' '/' ')'
[0] Additive : Additive ⏳ '+' Multiplicative ; ')' '+' '-'
[1] Additive : Additive ⏳ '-' Multiplicative ; ')' '+' '-' ")
syntaxState11("syntaxState11
[0] Additive : Additive '+' Multiplicative ⏳ ; '¥' '+' '-' ')'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; '¥' '+' '-' '*' '/' ')'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; '¥' '+' '-' '*' '/' ')' ")
syntaxState12("syntaxState12
[1] Additive : Additive '-' Multiplicative ⏳ ; '¥' '+' '-' ')'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; '¥' '+' '-' '*' '/' ')'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; '¥' '+' '-' '*' '/' ')' ")
syntaxState13("syntaxState13
[3] Multiplicative : Multiplicative '*' Primary ⏳ ; '¥' '+' '-' '*' '/' ')' ")
syntaxState14("syntaxState14
[4] Multiplicative : Multiplicative '/' Primary ⏳ ; '¥' '+' '-' '*' '/' ')' ")
syntaxState15("syntaxState15
[6] Primary : '(' Additive ')' ⏳ ; '¥' '+' '-' '*' '/' ')' ")
syntaxState0 -.-> |"Additive"| syntaxState1
syntaxState0 -.-> |"Multiplicative"| syntaxState2
syntaxState0 -.-> |"Primary"| syntaxState3
syntaxState0 --> |"'('"| syntaxState4
syntaxState0 --> |"'number'"| syntaxState5
syntaxState1 --> |"'+'"| syntaxState6
syntaxState1 --> |"'-'"| syntaxState7
syntaxState2 --> |"'*'"| syntaxState8
syntaxState2 --> |"'/'"| syntaxState9
syntaxState4 -.-> |"Additive"| syntaxState10
syntaxState4 -.-> |"Multiplicative"| syntaxState2
syntaxState4 -.-> |"Primary"| syntaxState3
syntaxState4 --> |"'('"| syntaxState4
syntaxState4 --> |"'number'"| syntaxState5
syntaxState6 -.-> |"Multiplicative"| syntaxState11
syntaxState6 -.-> |"Primary"| syntaxState3
syntaxState6 --> |"'('"| syntaxState4
syntaxState6 --> |"'number'"| syntaxState5
syntaxState7 -.-> |"Multiplicative"| syntaxState12
syntaxState7 -.-> |"Primary"| syntaxState3
syntaxState7 --> |"'('"| syntaxState4
syntaxState7 --> |"'number'"| syntaxState5
syntaxState8 -.-> |"Primary"| syntaxState13
syntaxState8 --> |"'('"| syntaxState4
syntaxState8 --> |"'number'"| syntaxState5
syntaxState9 -.-> |"Primary"| syntaxState14
syntaxState9 --> |"'('"| syntaxState4
syntaxState9 --> |"'number'"| syntaxState5
syntaxState10 --> |"')'"| syntaxState15
syntaxState10 --> |"'+'"| syntaxState6
syntaxState10 --> |"'-'"| syntaxState7
syntaxState11 --> |"'*'"| syntaxState8
syntaxState11 --> |"'/'"| syntaxState9
syntaxState12 --> |"'*'"| syntaxState8
syntaxState12 --> |"'/'"| syntaxState9
syntaxState1 o--o |"'¥'"| syntaxState1
syntaxState2 x==x |"'¥' '+' '-' ')'
R[2]= Additive : Multiplicative ;"| syntaxState2
syntaxState3 x==x |"'¥' '+' '-' '*' '/' ')'
R[5]= Multiplicative : Primary ;"| syntaxState3
syntaxState5 x==x |"'¥' '+' '-' '*' '/' ')'
R[7]= Primary : 'number' ;"| syntaxState5
syntaxState11 x==x |"'¥' '+' '-' ')'
R[0]= Additive : Additive '+' Multiplicative ;"| syntaxState11
syntaxState12 x==x |"'¥' '+' '-' ')'
R[1]= Additive : Additive '-' Multiplicative ;"| syntaxState12
syntaxState13 x==x |"'¥' '+' '-' '*' '/' ')'
R[3]= Multiplicative : Multiplicative '*' Primary ;"| syntaxState13
syntaxState14 x==x |"'¥' '+' '-' '*' '/' ')'
R[4]= Multiplicative : Multiplicative '/' Primary ;"| syntaxState14
syntaxState15 x==x |"'¥' '+' '-' '*' '/' ')'
R[6]= Primary : '(' Additive ')' ;"| syntaxState15
LR(1) Syntax Machine
状态 |
'+' |
'-' |
'*' |
'/' |
'(' |
')' |
'number' |
'¥' |
Additive |
Multiplicative |
Primary |
0 |
|
|
|
|
S4 |
|
S5 |
|
G1 |
G2 |
G3 |
1 |
S6 |
S7 |
|
|
|
|
|
完成 |
|
|
|
2 |
R[2] |
R[2] |
S8 |
S9 |
|
|
|
R[2] |
|
|
|
3 |
R[5] |
R[5] |
R[5] |
R[5] |
|
|
|
R[5] |
|
|
|
4 |
|
|
|
|
S13 |
|
S14 |
|
G10 |
G11 |
G12 |
5 |
R[7] |
R[7] |
R[7] |
R[7] |
|
|
|
R[7] |
|
|
|
6 |
|
|
|
|
S4 |
|
S5 |
|
|
G15 |
G3 |
7 |
|
|
|
|
S4 |
|
S5 |
|
|
G16 |
G3 |
8 |
|
|
|
|
S4 |
|
S5 |
|
|
|
G17 |
9 |
|
|
|
|
S4 |
|
S5 |
|
|
|
G18 |
10 |
S20 |
S21 |
|
|
|
S19 |
|
|
|
|
|
11 |
R[2] |
R[2] |
S22 |
S23 |
|
R[2] |
|
|
|
|
|
12 |
R[5] |
R[5] |
R[5] |
R[5] |
|
R[5] |
|
|
|
|
|
13 |
|
|
|
|
S13 |
|
S14 |
|
G24 |
G11 |
G12 |
14 |
R[7] |
R[7] |
R[7] |
R[7] |
|
R[7] |
|
|
|
|
|
15 |
R[0] |
R[0] |
S8 |
S9 |
|
|
|
R[0] |
|
|
|
16 |
R[1] |
R[1] |
S8 |
S9 |
|
|
|
R[1] |
|
|
|
17 |
R[3] |
R[3] |
R[3] |
R[3] |
|
|
|
R[3] |
|
|
|
18 |
R[4] |
R[4] |
R[4] |
R[4] |
|
|
|
R[4] |
|
|
|
19 |
R[6] |
R[6] |
R[6] |
R[6] |
|
|
|
R[6] |
|
|
|
20 |
|
|
|
|
S13 |
|
S14 |
|
|
G25 |
G12 |
21 |
|
|
|
|
S13 |
|
S14 |
|
|
G26 |
G12 |
22 |
|
|
|
|
S13 |
|
S14 |
|
|
|
G27 |
23 |
|
|
|
|
S13 |
|
S14 |
|
|
|
G28 |
24 |
S20 |
S21 |
|
|
|
S29 |
|
|
|
|
|
25 |
R[0] |
R[0] |
S22 |
S23 |
|
R[0] |
|
|
|
|
|
26 |
R[1] |
R[1] |
S22 |
S23 |
|
R[1] |
|
|
|
|
|
27 |
R[3] |
R[3] |
R[3] |
R[3] |
|
R[3] |
|
|
|
|
|
28 |
R[4] |
R[4] |
R[4] |
R[4] |
|
R[4] |
|
|
|
|
|
29 |
R[6] |
R[6] |
R[6] |
R[6] |
|
R[6] |
|
|
|
|
|
flowchart
classDef default fill:#C7EDCC,stroke:#993399,stroke-width:0px,text-align:left;
classDef titlebarStyle fill:gold;
titlebar>"LR(1) syntax states"]
class titlebar titlebarStyle
syntaxState0("syntaxState0
[-1] FinalValue> : ⏳ Additive ; '¥'
[0] Additive : ⏳ Additive '+' Multiplicative ; '¥' '+' '-'
[1] Additive : ⏳ Additive '-' Multiplicative ; '¥' '+' '-'
[2] Additive : ⏳ Multiplicative ; '¥' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; '¥' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; '¥' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; '¥' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ")
syntaxState1("syntaxState1
[-1] FinalValue> : Additive ⏳ ; '¥'
[0] Additive : Additive ⏳ '+' Multiplicative ; '¥' '+' '-'
[1] Additive : Additive ⏳ '-' Multiplicative ; '¥' '+' '-' ")
syntaxState2("syntaxState2
[2] Additive : Multiplicative ⏳ ; '¥' '+' '-'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; '¥' '+' '-' '*' '/'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; '¥' '+' '-' '*' '/' ")
syntaxState3("syntaxState3
[5] Multiplicative : Primary ⏳ ; '¥' '+' '-' '*' '/' ")
syntaxState4("syntaxState4
[6] Primary : '(' ⏳ Additive ')' ; '¥' '+' '-' '*' '/'
[0] Additive : ⏳ Additive '+' Multiplicative ; ')' '+' '-'
[1] Additive : ⏳ Additive '-' Multiplicative ; ')' '+' '-'
[2] Additive : ⏳ Multiplicative ; ')' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; ')' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; ')' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; ')' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; ')' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; ')' '+' '-' '*' '/' ")
syntaxState5("syntaxState5
[7] Primary : 'number' ⏳ ; '¥' '+' '-' '*' '/' ")
syntaxState6("syntaxState6
[0] Additive : Additive '+' ⏳ Multiplicative ; '¥' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; '¥' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; '¥' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; '¥' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ")
syntaxState7("syntaxState7
[1] Additive : Additive '-' ⏳ Multiplicative ; '¥' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; '¥' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; '¥' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; '¥' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ")
syntaxState8("syntaxState8
[3] Multiplicative : Multiplicative '*' ⏳ Primary ; '¥' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ")
syntaxState9("syntaxState9
[4] Multiplicative : Multiplicative '/' ⏳ Primary ; '¥' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; '¥' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; '¥' '+' '-' '*' '/' ")
syntaxState10("syntaxState10
[6] Primary : '(' Additive ⏳ ')' ; '¥' '+' '-' '*' '/'
[0] Additive : Additive ⏳ '+' Multiplicative ; ')' '+' '-'
[1] Additive : Additive ⏳ '-' Multiplicative ; ')' '+' '-' ")
syntaxState11("syntaxState11
[2] Additive : Multiplicative ⏳ ; ')' '+' '-'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; ')' '+' '-' '*' '/'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ')' '+' '-' '*' '/' ")
syntaxState12("syntaxState12
[5] Multiplicative : Primary ⏳ ; ')' '+' '-' '*' '/' ")
syntaxState13("syntaxState13
[6] Primary : '(' ⏳ Additive ')' ; ')' '+' '-' '*' '/'
[0] Additive : ⏳ Additive '+' Multiplicative ; ')' '+' '-'
[1] Additive : ⏳ Additive '-' Multiplicative ; ')' '+' '-'
[2] Additive : ⏳ Multiplicative ; ')' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; ')' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; ')' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; ')' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; ')' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; ')' '+' '-' '*' '/' ")
syntaxState14("syntaxState14
[7] Primary : 'number' ⏳ ; ')' '+' '-' '*' '/' ")
syntaxState15("syntaxState15
[0] Additive : Additive '+' Multiplicative ⏳ ; '¥' '+' '-'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; '¥' '+' '-' '*' '/'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; '¥' '+' '-' '*' '/' ")
syntaxState16("syntaxState16
[1] Additive : Additive '-' Multiplicative ⏳ ; '¥' '+' '-'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; '¥' '+' '-' '*' '/'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; '¥' '+' '-' '*' '/' ")
syntaxState17("syntaxState17
[3] Multiplicative : Multiplicative '*' Primary ⏳ ; '¥' '+' '-' '*' '/' ")
syntaxState18("syntaxState18
[4] Multiplicative : Multiplicative '/' Primary ⏳ ; '¥' '+' '-' '*' '/' ")
syntaxState19("syntaxState19
[6] Primary : '(' Additive ')' ⏳ ; '¥' '+' '-' '*' '/' ")
syntaxState20("syntaxState20
[0] Additive : Additive '+' ⏳ Multiplicative ; ')' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; ')' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; ')' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; ')' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; ')' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; ')' '+' '-' '*' '/' ")
syntaxState21("syntaxState21
[1] Additive : Additive '-' ⏳ Multiplicative ; ')' '+' '-'
[3] Multiplicative : ⏳ Multiplicative '*' Primary ; ')' '+' '-' '*' '/'
[4] Multiplicative : ⏳ Multiplicative '/' Primary ; ')' '+' '-' '*' '/'
[5] Multiplicative : ⏳ Primary ; ')' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; ')' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; ')' '+' '-' '*' '/' ")
syntaxState22("syntaxState22
[3] Multiplicative : Multiplicative '*' ⏳ Primary ; ')' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; ')' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; ')' '+' '-' '*' '/' ")
syntaxState23("syntaxState23
[4] Multiplicative : Multiplicative '/' ⏳ Primary ; ')' '+' '-' '*' '/'
[6] Primary : ⏳ '(' Additive ')' ; ')' '+' '-' '*' '/'
[7] Primary : ⏳ 'number' ; ')' '+' '-' '*' '/' ")
syntaxState24("syntaxState24
[6] Primary : '(' Additive ⏳ ')' ; ')' '+' '-' '*' '/'
[0] Additive : Additive ⏳ '+' Multiplicative ; ')' '+' '-'
[1] Additive : Additive ⏳ '-' Multiplicative ; ')' '+' '-' ")
syntaxState25("syntaxState25
[0] Additive : Additive '+' Multiplicative ⏳ ; ')' '+' '-'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; ')' '+' '-' '*' '/'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ')' '+' '-' '*' '/' ")
syntaxState26("syntaxState26
[1] Additive : Additive '-' Multiplicative ⏳ ; ')' '+' '-'
[3] Multiplicative : Multiplicative ⏳ '*' Primary ; ')' '+' '-' '*' '/'
[4] Multiplicative : Multiplicative ⏳ '/' Primary ; ')' '+' '-' '*' '/' ")
syntaxState27("syntaxState27
[3] Multiplicative : Multiplicative '*' Primary ⏳ ; ')' '+' '-' '*' '/' ")
syntaxState28("syntaxState28
[4] Multiplicative : Multiplicative '/' Primary ⏳ ; ')' '+' '-' '*' '/' ")
syntaxState29("syntaxState29
[6] Primary : '(' Additive ')' ⏳ ; ')' '+' '-' '*' '/' ")
syntaxState0 -.-> |"Additive"| syntaxState1
syntaxState0 -.-> |"Multiplicative"| syntaxState2
syntaxState0 -.-> |"Primary"| syntaxState3
syntaxState0 --> |"'('"| syntaxState4
syntaxState0 --> |"'number'"| syntaxState5
syntaxState1 --> |"'+'"| syntaxState6
syntaxState1 --> |"'-'"| syntaxState7
syntaxState2 --> |"'*'"| syntaxState8
syntaxState2 --> |"'/'"| syntaxState9
syntaxState4 -.-> |"Additive"| syntaxState10
syntaxState4 -.-> |"Multiplicative"| syntaxState11
syntaxState4 -.-> |"Primary"| syntaxState12
syntaxState4 --> |"'('"| syntaxState13
syntaxState4 --> |"'number'"| syntaxState14
syntaxState6 -.-> |"Multiplicative"| syntaxState15
syntaxState6 -.-> |"Primary"| syntaxState3
syntaxState6 --> |"'('"| syntaxState4
syntaxState6 --> |"'number'"| syntaxState5
syntaxState7 -.-> |"Multiplicative"| syntaxState16
syntaxState7 -.-> |"Primary"| syntaxState3
syntaxState7 --> |"'('"| syntaxState4
syntaxState7 --> |"'number'"| syntaxState5
syntaxState8 -.-> |"Primary"| syntaxState17
syntaxState8 --> |"'('"| syntaxState4
syntaxState8 --> |"'number'"| syntaxState5
syntaxState9 -.-> |"Primary"| syntaxState18
syntaxState9 --> |"'('"| syntaxState4
syntaxState9 --> |"'number'"| syntaxState5
syntaxState10 --> |"')'"| syntaxState19
syntaxState10 --> |"'+'"| syntaxState20
syntaxState10 --> |"'-'"| syntaxState21
syntaxState11 --> |"'*'"| syntaxState22
syntaxState11 --> |"'/'"| syntaxState23
syntaxState13 -.-> |"Additive"| syntaxState24
syntaxState13 -.-> |"Multiplicative"| syntaxState11
syntaxState13 -.-> |"Primary"| syntaxState12
syntaxState13 --> |"'('"| syntaxState13
syntaxState13 --> |"'number'"| syntaxState14
syntaxState15 --> |"'*'"| syntaxState8
syntaxState15 --> |"'/'"| syntaxState9
syntaxState16 --> |"'*'"| syntaxState8
syntaxState16 --> |"'/'"| syntaxState9
syntaxState20 -.-> |"Multiplicative"| syntaxState25
syntaxState20 -.-> |"Primary"| syntaxState12
syntaxState20 --> |"'('"| syntaxState13
syntaxState20 --> |"'number'"| syntaxState14
syntaxState21 -.-> |"Multiplicative"| syntaxState26
syntaxState21 -.-> |"Primary"| syntaxState12
syntaxState21 --> |"'('"| syntaxState13
syntaxState21 --> |"'number'"| syntaxState14
syntaxState22 -.-> |"Primary"| syntaxState27
syntaxState22 --> |"'('"| syntaxState13
syntaxState22 --> |"'number'"| syntaxState14
syntaxState23 -.-> |"Primary"| syntaxState28
syntaxState23 --> |"'('"| syntaxState13
syntaxState23 --> |"'number'"| syntaxState14
syntaxState24 --> |"')'"| syntaxState29
syntaxState24 --> |"'+'"| syntaxState20
syntaxState24 --> |"'-'"| syntaxState21
syntaxState25 --> |"'*'"| syntaxState22
syntaxState25 --> |"'/'"| syntaxState23
syntaxState26 --> |"'*'"| syntaxState22
syntaxState26 --> |"'/'"| syntaxState23
syntaxState1 o--o |"'¥'"| syntaxState1
syntaxState2 x==x |"'¥' '+' '-'
R[2]= Additive : Multiplicative ;"| syntaxState2
syntaxState3 x==x |"'¥' '+' '-' '*' '/'
R[5]= Multiplicative : Primary ;"| syntaxState3
syntaxState5 x==x |"'¥' '+' '-' '*' '/'
R[7]= Primary : 'number' ;"| syntaxState5
syntaxState11 x==x |"')' '+' '-'
R[2]= Additive : Multiplicative ;"| syntaxState11
syntaxState12 x==x |"')' '+' '-' '*' '/'
R[5]= Multiplicative : Primary ;"| syntaxState12
syntaxState14 x==x |"')' '+' '-' '*' '/'
R[7]= Primary : 'number' ;"| syntaxState14
syntaxState15 x==x |"'¥' '+' '-'
R[0]= Additive : Additive '+' Multiplicative ;"| syntaxState15
syntaxState16 x==x |"'¥' '+' '-'
R[1]= Additive : Additive '-' Multiplicative ;"| syntaxState16
syntaxState17 x==x |"'¥' '+' '-' '*' '/'
R[3]= Multiplicative : Multiplicative '*' Primary ;"| syntaxState17
syntaxState18 x==x |"'¥' '+' '-' '*' '/'
R[4]= Multiplicative : Multiplicative '/' Primary ;"| syntaxState18
syntaxState19 x==x |"'¥' '+' '-' '*' '/'
R[6]= Primary : '(' Additive ')' ;"| syntaxState19
syntaxState25 x==x |"')' '+' '-'
R[0]= Additive : Additive '+' Multiplicative ;"| syntaxState25
syntaxState26 x==x |"')' '+' '-'
R[1]= Additive : Additive '-' Multiplicative ;"| syntaxState26
syntaxState27 x==x |"')' '+' '-' '*' '/'
R[3]= Multiplicative : Multiplicative '*' Primary ;"| syntaxState27
syntaxState28 x==x |"')' '+' '-' '*' '/'
R[4]= Multiplicative : Multiplicative '/' Primary ;"| syntaxState28
syntaxState29 x==x |"')' '+' '-' '*' '/'
R[6]= Primary : '(' Additive ')' ;"| syntaxState29
End
标签:解析器,
Additive,
--,
一键,
Primary,
number,
-.-,
Multiplicative,
Calc
From: https://www.cnblogs.com/bitzhuwei/p/Calc-readme-full.html