一键生成`Scope`文法解析器

Compiler of Scope

The C# source code of the compiler Scope is generated by bitzhuwei.GrammarFormat.

Grammar

// 7 VnRegulations:
Scope : '[' 'firstItem1' RangeItems ']' // [0]
      | '[^' 'firstItem2' RangeItems ']' // [1]
      | '[' 'firstItem1' ']' // [2]
      | '[^' 'firstItem2' ']' ; // [3]
RangeItems : RangeItems RangeItem // [4]
           | RangeItem ; // [5]
RangeItem : 'char' ; // [6]
// 3 VtPatterns:
'firstItem1' : %%<'['>\\u[0-9]{4}|\\t|\\n|\\r|\\-|[ -Z]|\[|\\\\|]|\\\^|[_-~]%% ; // [0]
'firstItem2' : %%<'[^'>\\u[0-9]{4}|\\t|\\n|\\r|\\-|[ -Z]|\[|\\\\|]|\^|\\\^|[_-~]%% ; // [1]
'char' : %%\\u[0-9]{4}|\\t|\\n|\\r|\\-|[ -Z]|\\\[|\\\\|\\\]|\^|\\\^|[_-~]%% ; // [2]

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_-603342245{{"DFA0 wholeStart"}} class DFA0_-603342245 c1000; DFA1_1713515135{{"DFA1 {9}"}} DFA2_-553323402[\"DFA2 {1}"/] class DFA2_-553323402 c0101; DFA3_-745266114[\"DFA3 {1}"/] class DFA3_-745266114 c0101; DFA4_-828751645[\"DFA4 {1}"/] class DFA4_-828751645 c0101; DFA5_-1120597139[\"DFA5 {2}"/] class DFA5_-1120597139 c1101; DFA6_-537552203[\"DFA6 {1}"/] class DFA6_-537552203 c0101; DFA7_-1056941525{{"DFA7 {1}"}} DFA8_574477020[\"DFA8 {1}"/] class DFA8_574477020 c0101; DFA9_632238265[\"DFA9 {1}"/] class DFA9_632238265 c0101; DFA10_-1636350574[\"DFA10 {1}"/] class DFA10_-1636350574 c0101; DFA11_95618093[\"DFA11 {1}"/] class DFA11_95618093 c0101; DFA12_-439030261[\"DFA12 {1}"/] class DFA12_-439030261 c0101; DFA13_681635209[\"DFA13 {1}"/] class DFA13_681635209 c0101; DFA14_1803258553[\"DFA14 {1}"/] class DFA14_1803258553 c0101; DFA15_-347440012[\"DFA15 {1}"/] class DFA15_-347440012 c0101; DFA16_276894587{{"DFA16 {7}"}} DFA17_93492380[\"DFA17 {1}"/] class DFA17_93492380 c0101; DFA18_-1735416304[\"DFA18 {1}"/] class DFA18_-1735416304 c0101; DFA19_-832048514[\"DFA19 {1}"/] class DFA19_-832048514 c0101; DFA20_-914515488[\"DFA20 {1}"/] class DFA20_-914515488 c0101; DFA21_-1516357150[\"DFA21 {1}"/] class DFA21_-1516357150 c1101; DFA22_-1556708861{{"DFA22 {1}"}} DFA23_-1369602486{{"DFA23 {1}"}} DFA24_949339837[\"DFA24 {1}"/] class DFA24_949339837 c0101; DFA25_-1713648208[\"DFA25 {1}"/] class DFA25_-1713648208 c0101; DFA26_-1861299182[\"DFA26 {1}"/] class DFA26_-1861299182 c0101; DFA27_1400453737[\"DFA27 {1}"/] class DFA27_1400453737 c0101; DFA28_-1099582488[\"DFA28 {1}"/] class DFA28_-1099582488 c0101; DFA29_-1367244352[\"DFA29 {1}"/] class DFA29_-1367244352 c0101; DFA30_-341383368{{"DFA30 {7}"}} DFA31_233804070[\"DFA31 {1}"/] class DFA31_233804070 c0101; DFA32_-1314823399[\"DFA32 {1}"/] class DFA32_-1314823399 c0101; DFA33_163354418[\"DFA33 {1}"/] class DFA33_163354418 c0101; DFA34_-591348661[\"DFA34 {1}"/] class DFA34_-591348661 c0101; DFA35_562927614[\"DFA35 {1}"/] class DFA35_562927614 c0101; DFA36_419700058{{"DFA36 {1}"}} DFA37_1437861796{{"DFA37 {1}"}} DFA38_1246312758{{"DFA38 {1}"}} DFA39_2017073729[\"DFA39 {1}"/] class DFA39_2017073729 c0101; DFA40_105366111[\"DFA40 {1}"/] class DFA40_105366111 c0101; DFA41_1754430448[\"DFA41 {1}"/] class DFA41_1754430448 c0101; DFA42_-717753608[\"DFA42 {1}"/] class DFA42_-717753608 c0101; DFA43_804681666[\"DFA43 {1}"/] class DFA43_804681666 c0101; DFA44_-638500707[\"DFA44 {1}"/] class DFA44_-638500707 c0101; DFA45_-1674334099{{"DFA45 {1}"}} DFA46_1831127891{{"DFA46 {1}"}} DFA47_-898201558{{"DFA47 {1}"}} DFA48_1730329631[\"DFA48 {1}"/] class DFA48_1730329631 c0101; DFA49_-600464368{{"DFA49 {1}"}} DFA50_-483347670{{"DFA50 {1}"}} DFA51_-380469594[\"DFA51 {1}"/] class DFA51_-380469594 c0101; DFA52_1643089294{{"DFA52 {1}"}} DFA53_-1030264643[\"DFA53 {1}"/] class DFA53_-1030264643 c0101; DFA0_-603342245 -->|"#92; BeginToken 'char'"|DFA1_1713515135 DFA0_-603342245 -->|"[#32;-Z] BeginToken 'char' ExtendToken 'char'"|DFA2_-553323402 DFA0_-603342245 -->|"^ BeginToken 'char' ExtendToken 'char'"|DFA3_-745266114 DFA0_-603342245 -->|"[_-~] BeginToken 'char' ExtendToken 'char'"|DFA4_-828751645 DFA0_-603342245 -->|"[ BeginToken '[''[^' ExtendToken '['"|DFA5_-1120597139 DFA0_-603342245 -->|"] BeginToken ']' ExtendToken ']'"|DFA6_-537552203 DFA1_1713515135 -->|"u"|DFA7_-1056941525 DFA1_1713515135 -->|"t ExtendToken 'char'"|DFA8_574477020 DFA1_1713515135 -->|"n ExtendToken 'char'"|DFA9_632238265 DFA1_1713515135 -->|"r ExtendToken 'char'"|DFA10_-1636350574 DFA1_1713515135 -->|"- ExtendToken 'char'"|DFA11_95618093 DFA1_1713515135 -->|"[ ExtendToken 'char'"|DFA12_-439030261 DFA1_1713515135 -->|"#92; ExtendToken 'char'"|DFA13_681635209 DFA1_1713515135 -->|"] ExtendToken 'char'"|DFA14_1803258553 DFA1_1713515135 -->|"^ ExtendToken 'char'"|DFA15_-347440012 DFA5_-1120597139 -->|"#92; AcceptPrevious '[' BeginToken 'firstItem1'"|DFA16_276894587 DFA5_-1120597139 -->|"[#32;-Z] AcceptPrevious '[' BeginToken 'firstItem1' ExtendToken 'firstItem1'"|DFA17_93492380 DFA5_-1120597139 -->|"[ AcceptPrevious '[' BeginToken 'firstItem1' ExtendToken 'firstItem1'"|DFA18_-1735416304 DFA5_-1120597139 -->|"] AcceptPrevious '[' BeginToken 'firstItem1' ExtendToken 'firstItem1'"|DFA19_-832048514 DFA5_-1120597139 -->|"[_-~] AcceptPrevious '[' BeginToken 'firstItem1' ExtendToken 'firstItem1'"|DFA20_-914515488 DFA5_-1120597139 -->|"^ ExtendToken '[^'"|DFA21_-1516357150 DFA7_-1056941525 -->|"[0-9]"|DFA22_-1556708861 DFA16_276894587 -->|"u"|DFA23_-1369602486 DFA16_276894587 -->|"t ExtendToken 'firstItem1'"|DFA24_949339837 DFA16_276894587 -->|"n ExtendToken 'firstItem1'"|DFA25_-1713648208 DFA16_276894587 -->|"r ExtendToken 'firstItem1'"|DFA26_-1861299182 DFA16_276894587 -->|"- ExtendToken 'firstItem1'"|DFA27_1400453737 DFA16_276894587 -->|"#92; ExtendToken 'firstItem1'"|DFA28_-1099582488 DFA16_276894587 -->|"^ ExtendToken 'firstItem1'"|DFA29_-1367244352 DFA21_-1516357150 -->|"#92; AcceptPrevious '[^' BeginToken 'firstItem2'"|DFA30_-341383368 DFA21_-1516357150 -->|"[#32;-Z] AcceptPrevious '[^' BeginToken 'firstItem2' ExtendToken 'firstItem2'"|DFA31_233804070 DFA21_-1516357150 -->|"[ AcceptPrevious '[^' BeginToken 'firstItem2' ExtendToken 'firstItem2'"|DFA32_-1314823399 DFA21_-1516357150 -->|"] AcceptPrevious '[^' BeginToken 'firstItem2' ExtendToken 'firstItem2'"|DFA33_163354418 DFA21_-1516357150 -->|"^ AcceptPrevious '[^' BeginToken 'firstItem2' ExtendToken 'firstItem2'"|DFA34_-591348661 DFA21_-1516357150 -->|"[_-~] AcceptPrevious '[^' BeginToken 'firstItem2' ExtendToken 'firstItem2'"|DFA35_562927614 DFA22_-1556708861 -->|"[0-9]"|DFA36_419700058 DFA23_-1369602486 -->|"[0-9]"|DFA37_1437861796 DFA30_-341383368 -->|"u"|DFA38_1246312758 DFA30_-341383368 -->|"t ExtendToken 'firstItem2'"|DFA39_2017073729 DFA30_-341383368 -->|"n ExtendToken 'firstItem2'"|DFA40_105366111 DFA30_-341383368 -->|"r ExtendToken 'firstItem2'"|DFA41_1754430448 DFA30_-341383368 -->|"- ExtendToken 'firstItem2'"|DFA42_-717753608 DFA30_-341383368 -->|"#92; ExtendToken 'firstItem2'"|DFA43_804681666 DFA30_-341383368 -->|"^ ExtendToken 'firstItem2'"|DFA44_-638500707 DFA36_419700058 -->|"[0-9]"|DFA45_-1674334099 DFA37_1437861796 -->|"[0-9]"|DFA46_1831127891 DFA38_1246312758 -->|"[0-9]"|DFA47_-898201558 DFA45_-1674334099 -->|"[0-9] ExtendToken 'char'"|DFA48_1730329631 DFA46_1831127891 -->|"[0-9]"|DFA49_-600464368 DFA47_-898201558 -->|"[0-9]"|DFA50_-483347670 DFA49_-600464368 -->|"[0-9] ExtendToken 'firstItem1'"|DFA51_-380469594 DFA50_-483347670 -->|"[0-9]"|DFA52_1643089294 DFA52_1643089294 -->|"[0-9] ExtendToken 'firstItem2'"|DFA53_-1030264643

nullable

[0]: nullable( Scope ) = False
[1]: nullable( '[' ) = False
[2]: nullable( 'firstItem1' ) = False
[3]: nullable( RangeItems ) = False
[4]: nullable( ']' ) = False
[5]: nullable( '[^' ) = False
[6]: nullable( 'firstItem2' ) = False
[7]: nullable( RangeItem ) = False
[8]: nullable( 'char' ) = False
[9]: nullable(  ) = True

FIRST

[0]: FIRST( Scope ) = { '[' '[^' }
[1]: FIRST( RangeItems ) = { 'char' }
[2]: FIRST( RangeItem ) = { 'char' }
[3]: FIRST( '[' ) = { '[' }
[4]: FIRST( 'firstItem1' ) = { 'firstItem1' }
[5]: FIRST( ']' ) = { ']' }
[6]: FIRST( '[^' ) = { '[^' }
[7]: FIRST( 'firstItem2' ) = { 'firstItem2' }
[8]: FIRST( 'char' ) = { 'char' }
[9]: FIRST(  ) = { empty }
[10]: FIRST( '[' 'firstItem1' RangeItems ']' ) = { '[' }
[11]: FIRST( '[^' 'firstItem2' RangeItems ']' ) = { '[^' }
[12]: FIRST( '[' 'firstItem1' ']' ) = { '[' }
[13]: FIRST( '[^' 'firstItem2' ']' ) = { '[^' }
[14]: FIRST( RangeItems RangeItem ) = { 'char' }

FOLLOW

[0]: FOLLOW( Scope ) = { }
[1]: FOLLOW( RangeItems ) = { ']' 'char' }
[2]: FOLLOW( RangeItem ) = { ']' 'char' }

LL(1) Syntax Machine

状态 '[' 'firstItem1' ']' '[^' 'firstItem2' 'char'
Scope R[0] R[2] R[1] R[3]
RangeItems R[4] R[5]
RangeItem R[6]

LR(0) Syntax Machine

状态 '[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' Scope RangeItems RangeItem
0 S2 S3 G1
1 完成
2 S4
3 S5
4 S7 S9 G6 G8
5 S11 S9 G10 G8
6 S12 S9 G13
7 R[2] R[2] R[2] R[2] R[2] R[2] R[2]
8 R[5] R[5] R[5] R[5] R[5] R[5] R[5]
9 R[6] R[6] R[6] R[6] R[6] R[6] R[6]
10 S14 S9 G13
11 R[3] R[3] R[3] R[3] R[3] R[3] R[3]
12 R[0] R[0] R[0] R[0] R[0] R[0] R[0]
13 R[4] R[4] R[4] R[4] R[4] R[4] R[4]
14 R[1] R[1] R[1] R[1] R[1] R[1] R[1]
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] ResolvedScope> : ⏳ Scope ; [0] Scope : ⏳ '[' 'firstItem1' RangeItems ']' ; [1] Scope : ⏳ '[^' 'firstItem2' RangeItems ']' ; [2] Scope : ⏳ '[' 'firstItem1' ']' ; [3] Scope : ⏳ '[^' 'firstItem2' ']' ; ") syntaxState1("syntaxState1 [-1] ResolvedScope> : Scope ⏳ ; ") syntaxState2("syntaxState2 [0] Scope : '[' ⏳ 'firstItem1' RangeItems ']' ; [2] Scope : '[' ⏳ 'firstItem1' ']' ; ") syntaxState3("syntaxState3 [1] Scope : '[^' ⏳ 'firstItem2' RangeItems ']' ; [3] Scope : '[^' ⏳ 'firstItem2' ']' ; ") syntaxState4("syntaxState4 [0] Scope : '[' 'firstItem1' ⏳ RangeItems ']' ; [2] Scope : '[' 'firstItem1' ⏳ ']' ; [4] RangeItems : ⏳ RangeItems RangeItem ; [5] RangeItems : ⏳ RangeItem ; [6] RangeItem : ⏳ 'char' ; ") syntaxState5("syntaxState5 [1] Scope : '[^' 'firstItem2' ⏳ RangeItems ']' ; [3] Scope : '[^' 'firstItem2' ⏳ ']' ; [4] RangeItems : ⏳ RangeItems RangeItem ; [5] RangeItems : ⏳ RangeItem ; [6] RangeItem : ⏳ 'char' ; ") syntaxState6("syntaxState6 [0] Scope : '[' 'firstItem1' RangeItems ⏳ ']' ; [4] RangeItems : RangeItems ⏳ RangeItem ; [6] RangeItem : ⏳ 'char' ; ") syntaxState7("syntaxState7 [2] Scope : '[' 'firstItem1' ']' ⏳ ; ") syntaxState8("syntaxState8 [5] RangeItems : RangeItem ⏳ ; ") syntaxState9("syntaxState9 [6] RangeItem : 'char' ⏳ ; ") syntaxState10("syntaxState10 [1] Scope : '[^' 'firstItem2' RangeItems ⏳ ']' ; [4] RangeItems : RangeItems ⏳ RangeItem ; [6] RangeItem : ⏳ 'char' ; ") syntaxState11("syntaxState11 [3] Scope : '[^' 'firstItem2' ']' ⏳ ; ") syntaxState12("syntaxState12 [0] Scope : '[' 'firstItem1' RangeItems ']' ⏳ ; ") syntaxState13("syntaxState13 [4] RangeItems : RangeItems RangeItem ⏳ ; ") syntaxState14("syntaxState14 [1] Scope : '[^' 'firstItem2' RangeItems ']' ⏳ ; ") syntaxState0 -.-> |"Scope"| syntaxState1 syntaxState0 --> |"'['"| syntaxState2 syntaxState0 --> |"'[^'"| syntaxState3 syntaxState2 --> |"'firstItem1'"| syntaxState4 syntaxState3 --> |"'firstItem2'"| syntaxState5 syntaxState4 -.-> |"RangeItems"| syntaxState6 syntaxState4 --> |"']'"| syntaxState7 syntaxState4 -.-> |"RangeItem"| syntaxState8 syntaxState4 --> |"'char'"| syntaxState9 syntaxState5 -.-> |"RangeItems"| syntaxState10 syntaxState5 --> |"']'"| syntaxState11 syntaxState5 -.-> |"RangeItem"| syntaxState8 syntaxState5 --> |"'char'"| syntaxState9 syntaxState6 --> |"']'"| syntaxState12 syntaxState6 -.-> |"RangeItem"| syntaxState13 syntaxState6 --> |"'char'"| syntaxState9 syntaxState10 --> |"']'"| syntaxState14 syntaxState10 -.-> |"RangeItem"| syntaxState13 syntaxState10 --> |"'char'"| syntaxState9 syntaxState1 o--o |"'¥'"| syntaxState1 syntaxState7 x==x |"'[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' R[2]= Scope : '[' 'firstItem1' ']' ;"| syntaxState7 syntaxState8 x==x |"'[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' R[5]= RangeItems : RangeItem ;"| syntaxState8 syntaxState9 x==x |"'[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' R[6]= RangeItem : 'char' ;"| syntaxState9 syntaxState11 x==x |"'[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' R[3]= Scope : '[^' 'firstItem2' ']' ;"| syntaxState11 syntaxState12 x==x |"'[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' R[0]= Scope : '[' 'firstItem1' RangeItems ']' ;"| syntaxState12 syntaxState13 x==x |"'[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' R[4]= RangeItems : RangeItems RangeItem ;"| syntaxState13 syntaxState14 x==x |"'[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' R[1]= Scope : '[^' 'firstItem2' RangeItems ']' ;"| syntaxState14

SLR(1) Syntax Machine

状态 '[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' Scope RangeItems RangeItem
0 S2 S3 G1
1 完成
2 S4
3 S5
4 S7 S9 G6 G8
5 S11 S9 G10 G8
6 S12 S9 G13
7 R[2]
8 R[5] R[5]
9 R[6] R[6]
10 S14 S9 G13
11 R[3]
12 R[0]
13 R[4] R[4]
14 R[1]
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] ResolvedScope> : ⏳ Scope ; [0] Scope : ⏳ '[' 'firstItem1' RangeItems ']' ; [1] Scope : ⏳ '[^' 'firstItem2' RangeItems ']' ; [2] Scope : ⏳ '[' 'firstItem1' ']' ; [3] Scope : ⏳ '[^' 'firstItem2' ']' ; ") syntaxState1("syntaxState1 [-1] ResolvedScope> : Scope ⏳ ; ") syntaxState2("syntaxState2 [0] Scope : '[' ⏳ 'firstItem1' RangeItems ']' ; [2] Scope : '[' ⏳ 'firstItem1' ']' ; ") syntaxState3("syntaxState3 [1] Scope : '[^' ⏳ 'firstItem2' RangeItems ']' ; [3] Scope : '[^' ⏳ 'firstItem2' ']' ; ") syntaxState4("syntaxState4 [0] Scope : '[' 'firstItem1' ⏳ RangeItems ']' ; [2] Scope : '[' 'firstItem1' ⏳ ']' ; [4] RangeItems : ⏳ RangeItems RangeItem ; [5] RangeItems : ⏳ RangeItem ; [6] RangeItem : ⏳ 'char' ; ") syntaxState5("syntaxState5 [1] Scope : '[^' 'firstItem2' ⏳ RangeItems ']' ; [3] Scope : '[^' 'firstItem2' ⏳ ']' ; [4] RangeItems : ⏳ RangeItems RangeItem ; [5] RangeItems : ⏳ RangeItem ; [6] RangeItem : ⏳ 'char' ; ") syntaxState6("syntaxState6 [0] Scope : '[' 'firstItem1' RangeItems ⏳ ']' ; [4] RangeItems : RangeItems ⏳ RangeItem ; [6] RangeItem : ⏳ 'char' ; ") syntaxState7("syntaxState7 [2] Scope : '[' 'firstItem1' ']' ⏳ ; ") syntaxState8("syntaxState8 [5] RangeItems : RangeItem ⏳ ; ") syntaxState9("syntaxState9 [6] RangeItem : 'char' ⏳ ; ") syntaxState10("syntaxState10 [1] Scope : '[^' 'firstItem2' RangeItems ⏳ ']' ; [4] RangeItems : RangeItems ⏳ RangeItem ; [6] RangeItem : ⏳ 'char' ; ") syntaxState11("syntaxState11 [3] Scope : '[^' 'firstItem2' ']' ⏳ ; ") syntaxState12("syntaxState12 [0] Scope : '[' 'firstItem1' RangeItems ']' ⏳ ; ") syntaxState13("syntaxState13 [4] RangeItems : RangeItems RangeItem ⏳ ; ") syntaxState14("syntaxState14 [1] Scope : '[^' 'firstItem2' RangeItems ']' ⏳ ; ") syntaxState0 -.-> |"Scope"| syntaxState1 syntaxState0 --> |"'['"| syntaxState2 syntaxState0 --> |"'[^'"| syntaxState3 syntaxState2 --> |"'firstItem1'"| syntaxState4 syntaxState3 --> |"'firstItem2'"| syntaxState5 syntaxState4 -.-> |"RangeItems"| syntaxState6 syntaxState4 --> |"']'"| syntaxState7 syntaxState4 -.-> |"RangeItem"| syntaxState8 syntaxState4 --> |"'char'"| syntaxState9 syntaxState5 -.-> |"RangeItems"| syntaxState10 syntaxState5 --> |"']'"| syntaxState11 syntaxState5 -.-> |"RangeItem"| syntaxState8 syntaxState5 --> |"'char'"| syntaxState9 syntaxState6 --> |"']'"| syntaxState12 syntaxState6 -.-> |"RangeItem"| syntaxState13 syntaxState6 --> |"'char'"| syntaxState9 syntaxState10 --> |"']'"| syntaxState14 syntaxState10 -.-> |"RangeItem"| syntaxState13 syntaxState10 --> |"'char'"| syntaxState9 syntaxState1 o--o |"'¥'"| syntaxState1 syntaxState7 x==x |"'¥' R[2]= Scope : '[' 'firstItem1' ']' ;"| syntaxState7 syntaxState8 x==x |"']' 'char' R[5]= RangeItems : RangeItem ;"| syntaxState8 syntaxState9 x==x |"']' 'char' R[6]= RangeItem : 'char' ;"| syntaxState9 syntaxState11 x==x |"'¥' R[3]= Scope : '[^' 'firstItem2' ']' ;"| syntaxState11 syntaxState12 x==x |"'¥' R[0]= Scope : '[' 'firstItem1' RangeItems ']' ;"| syntaxState12 syntaxState13 x==x |"']' 'char' R[4]= RangeItems : RangeItems RangeItem ;"| syntaxState13 syntaxState14 x==x |"'¥' R[1]= Scope : '[^' 'firstItem2' RangeItems ']' ;"| syntaxState14

LALR(1) Syntax Machine

状态 '[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' Scope RangeItems RangeItem
0 S2 S3 G1
1 完成
2 S4
3 S5
4 S7 S9 G6 G8
5 S11 S9 G10 G8
6 S12 S9 G13
7 R[2]
8 R[5] R[5]
9 R[6] R[6]
10 S14 S9 G13
11 R[3]
12 R[0]
13 R[4] R[4]
14 R[1]
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] ResolvedScope> : ⏳ Scope ; '¥' [0] Scope : ⏳ '[' 'firstItem1' RangeItems ']' ; '¥' [1] Scope : ⏳ '[^' 'firstItem2' RangeItems ']' ; '¥' [2] Scope : ⏳ '[' 'firstItem1' ']' ; '¥' [3] Scope : ⏳ '[^' 'firstItem2' ']' ; '¥' ") syntaxState1("syntaxState1 [-1] ResolvedScope> : Scope ⏳ ; '¥' ") syntaxState2("syntaxState2 [0] Scope : '[' ⏳ 'firstItem1' RangeItems ']' ; '¥' [2] Scope : '[' ⏳ 'firstItem1' ']' ; '¥' ") syntaxState3("syntaxState3 [1] Scope : '[^' ⏳ 'firstItem2' RangeItems ']' ; '¥' [3] Scope : '[^' ⏳ 'firstItem2' ']' ; '¥' ") syntaxState4("syntaxState4 [0] Scope : '[' 'firstItem1' ⏳ RangeItems ']' ; '¥' [2] Scope : '[' 'firstItem1' ⏳ ']' ; '¥' [4] RangeItems : ⏳ RangeItems RangeItem ; ']' 'char' [5] RangeItems : ⏳ RangeItem ; ']' 'char' [6] RangeItem : ⏳ 'char' ; ']' 'char' ") syntaxState5("syntaxState5 [1] Scope : '[^' 'firstItem2' ⏳ RangeItems ']' ; '¥' [3] Scope : '[^' 'firstItem2' ⏳ ']' ; '¥' [4] RangeItems : ⏳ RangeItems RangeItem ; ']' 'char' [5] RangeItems : ⏳ RangeItem ; ']' 'char' [6] RangeItem : ⏳ 'char' ; ']' 'char' ") syntaxState6("syntaxState6 [0] Scope : '[' 'firstItem1' RangeItems ⏳ ']' ; '¥' [4] RangeItems : RangeItems ⏳ RangeItem ; ']' 'char' [6] RangeItem : ⏳ 'char' ; ']' 'char' ") syntaxState7("syntaxState7 [2] Scope : '[' 'firstItem1' ']' ⏳ ; '¥' ") syntaxState8("syntaxState8 [5] RangeItems : RangeItem ⏳ ; ']' 'char' ") syntaxState9("syntaxState9 [6] RangeItem : 'char' ⏳ ; ']' 'char' ") syntaxState10("syntaxState10 [1] Scope : '[^' 'firstItem2' RangeItems ⏳ ']' ; '¥' [4] RangeItems : RangeItems ⏳ RangeItem ; ']' 'char' [6] RangeItem : ⏳ 'char' ; ']' 'char' ") syntaxState11("syntaxState11 [3] Scope : '[^' 'firstItem2' ']' ⏳ ; '¥' ") syntaxState12("syntaxState12 [0] Scope : '[' 'firstItem1' RangeItems ']' ⏳ ; '¥' ") syntaxState13("syntaxState13 [4] RangeItems : RangeItems RangeItem ⏳ ; ']' 'char' ") syntaxState14("syntaxState14 [1] Scope : '[^' 'firstItem2' RangeItems ']' ⏳ ; '¥' ") syntaxState0 -.-> |"Scope"| syntaxState1 syntaxState0 --> |"'['"| syntaxState2 syntaxState0 --> |"'[^'"| syntaxState3 syntaxState2 --> |"'firstItem1'"| syntaxState4 syntaxState3 --> |"'firstItem2'"| syntaxState5 syntaxState4 -.-> |"RangeItems"| syntaxState6 syntaxState4 --> |"']'"| syntaxState7 syntaxState4 -.-> |"RangeItem"| syntaxState8 syntaxState4 --> |"'char'"| syntaxState9 syntaxState5 -.-> |"RangeItems"| syntaxState10 syntaxState5 --> |"']'"| syntaxState11 syntaxState5 -.-> |"RangeItem"| syntaxState8 syntaxState5 --> |"'char'"| syntaxState9 syntaxState6 --> |"']'"| syntaxState12 syntaxState6 -.-> |"RangeItem"| syntaxState13 syntaxState6 --> |"'char'"| syntaxState9 syntaxState10 --> |"']'"| syntaxState14 syntaxState10 -.-> |"RangeItem"| syntaxState13 syntaxState10 --> |"'char'"| syntaxState9 syntaxState1 o--o |"'¥'"| syntaxState1 syntaxState7 x==x |"'¥' R[2]= Scope : '[' 'firstItem1' ']' ;"| syntaxState7 syntaxState8 x==x |"']' 'char' R[5]= RangeItems : RangeItem ;"| syntaxState8 syntaxState9 x==x |"']' 'char' R[6]= RangeItem : 'char' ;"| syntaxState9 syntaxState11 x==x |"'¥' R[3]= Scope : '[^' 'firstItem2' ']' ;"| syntaxState11 syntaxState12 x==x |"'¥' R[0]= Scope : '[' 'firstItem1' RangeItems ']' ;"| syntaxState12 syntaxState13 x==x |"']' 'char' R[4]= RangeItems : RangeItems RangeItem ;"| syntaxState13 syntaxState14 x==x |"'¥' R[1]= Scope : '[^' 'firstItem2' RangeItems ']' ;"| syntaxState14

LR(1) Syntax Machine

状态 '[' 'firstItem1' ']' '[^' 'firstItem2' 'char' '¥' Scope RangeItems RangeItem
0 S2 S3 G1
1 完成
2 S4
3 S5
4 S7 S9 G6 G8
5 S11 S9 G10 G8
6 S12 S9 G13
7 R[2]
8 R[5] R[5]
9 R[6] R[6]
10 S14 S9 G13
11 R[3]
12 R[0]
13 R[4] R[4]
14 R[1]
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] ResolvedScope> : ⏳ Scope ; '¥' [0] Scope : ⏳ '[' 'firstItem1' RangeItems ']' ; '¥' [1] Scope : ⏳ '[^' 'firstItem2' RangeItems ']' ; '¥' [2] Scope : ⏳ '[' 'firstItem1' ']' ; '¥' [3] Scope : ⏳ '[^' 'firstItem2' ']' ; '¥' ") syntaxState1("syntaxState1 [-1] ResolvedScope> : Scope ⏳ ; '¥' ") syntaxState2("syntaxState2 [0] Scope : '[' ⏳ 'firstItem1' RangeItems ']' ; '¥' [2] Scope : '[' ⏳ 'firstItem1' ']' ; '¥' ") syntaxState3("syntaxState3 [1] Scope : '[^' ⏳ 'firstItem2' RangeItems ']' ; '¥' [3] Scope : '[^' ⏳ 'firstItem2' ']' ; '¥' ") syntaxState4("syntaxState4 [0] Scope : '[' 'firstItem1' ⏳ RangeItems ']' ; '¥' [2] Scope : '[' 'firstItem1' ⏳ ']' ; '¥' [4] RangeItems : ⏳ RangeItems RangeItem ; ']' 'char' [5] RangeItems : ⏳ RangeItem ; ']' 'char' [6] RangeItem : ⏳ 'char' ; ']' 'char' ") syntaxState5("syntaxState5 [1] Scope : '[^' 'firstItem2' ⏳ RangeItems ']' ; '¥' [3] Scope : '[^' 'firstItem2' ⏳ ']' ; '¥' [4] RangeItems : ⏳ RangeItems RangeItem ; ']' 'char' [5] RangeItems : ⏳ RangeItem ; ']' 'char' [6] RangeItem : ⏳ 'char' ; ']' 'char' ") syntaxState6("syntaxState6 [0] Scope : '[' 'firstItem1' RangeItems ⏳ ']' ; '¥' [4] RangeItems : RangeItems ⏳ RangeItem ; ']' 'char' [6] RangeItem : ⏳ 'char' ; ']' 'char' ") syntaxState7("syntaxState7 [2] Scope : '[' 'firstItem1' ']' ⏳ ; '¥' ") syntaxState8("syntaxState8 [5] RangeItems : RangeItem ⏳ ; ']' 'char' ") syntaxState9("syntaxState9 [6] RangeItem : 'char' ⏳ ; ']' 'char' ") syntaxState10("syntaxState10 [1] Scope : '[^' 'firstItem2' RangeItems ⏳ ']' ; '¥' [4] RangeItems : RangeItems ⏳ RangeItem ; ']' 'char' [6] RangeItem : ⏳ 'char' ; ']' 'char' ") syntaxState11("syntaxState11 [3] Scope : '[^' 'firstItem2' ']' ⏳ ; '¥' ") syntaxState12("syntaxState12 [0] Scope : '[' 'firstItem1' RangeItems ']' ⏳ ; '¥' ") syntaxState13("syntaxState13 [4] RangeItems : RangeItems RangeItem ⏳ ; ']' 'char' ") syntaxState14("syntaxState14 [1] Scope : '[^' 'firstItem2' RangeItems ']' ⏳ ; '¥' ") syntaxState0 -.-> |"Scope"| syntaxState1 syntaxState0 --> |"'['"| syntaxState2 syntaxState0 --> |"'[^'"| syntaxState3 syntaxState2 --> |"'firstItem1'"| syntaxState4 syntaxState3 --> |"'firstItem2'"| syntaxState5 syntaxState4 -.-> |"RangeItems"| syntaxState6 syntaxState4 --> |"']'"| syntaxState7 syntaxState4 -.-> |"RangeItem"| syntaxState8 syntaxState4 --> |"'char'"| syntaxState9 syntaxState5 -.-> |"RangeItems"| syntaxState10 syntaxState5 --> |"']'"| syntaxState11 syntaxState5 -.-> |"RangeItem"| syntaxState8 syntaxState5 --> |"'char'"| syntaxState9 syntaxState6 --> |"']'"| syntaxState12 syntaxState6 -.-> |"RangeItem"| syntaxState13 syntaxState6 --> |"'char'"| syntaxState9 syntaxState10 --> |"']'"| syntaxState14 syntaxState10 -.-> |"RangeItem"| syntaxState13 syntaxState10 --> |"'char'"| syntaxState9 syntaxState1 o--o |"'¥'"| syntaxState1 syntaxState7 x==x |"'¥' R[2]= Scope : '[' 'firstItem1' ']' ;"| syntaxState7 syntaxState8 x==x |"']' 'char' R[5]= RangeItems : RangeItem ;"| syntaxState8 syntaxState9 x==x |"']' 'char' R[6]= RangeItem : 'char' ;"| syntaxState9 syntaxState11 x==x |"'¥' R[3]= Scope : '[^' 'firstItem2' ']' ;"| syntaxState11 syntaxState12 x==x |"'¥' R[0]= Scope : '[' 'firstItem1' RangeItems ']' ;"| syntaxState12 syntaxState13 x==x |"']' 'char' R[4]= RangeItems : RangeItems RangeItem ;"| syntaxState13 syntaxState14 x==x |"'¥' R[1]= Scope : '[^' 'firstItem2' RangeItems ']' ;"| syntaxState14

End

posted @ 2023-05-13 19:05  BIT祝威  阅读(45)  评论(0编辑  收藏  举报