[gram]
00: $start → all
01: all → all$1 Dump::Symbols();
02: all$1 →
03: all$1 → all$1 var_dec_list ;
04: all$1 → all$1 simple_type:1 name:2 (:3 $3=Proc::OpenHead($2,$1); proc$2 ) Proc::CloseHead($3); block:6 Proc::CloseBody($3,$6);
05: all$1 → all$1 error
06: proc$3 → simple_type:1 var_name:2 Var::Declare($2,$1);
07: proc$3 → proc$3 , simple_type:1 var_name:2 Var::Declare($2,$1);
08: proc$2 →
09: proc$2 → proc$3
10: var_dec_list → simple_type:1 var_dec_list$4:2 Var::Declare($2,$1);
11: var_dec_list$4 → var_name:1 $1->next=$-;$$=$1;
12: var_dec_list$4 → var_dec_list$4:3 , var_name:1 $1->next=$3;$$=$1;
13: var_name → name:1 var_name$5:2 =Symbol::NewVar($1,$2);
14: var_name$5 →
15: var_name$5 → var_name$5:4 [ num:2 ] =Type::NewDim($2,$4);
16: var_name$5 → var_name$5 [ error ]
17: simple_type → auto =Type::Auto;
18: simple_type → void =Type::Void;
19: simple_type → float =Type::Float;
20: simple_type → int =Type::S32;
21: simple_type → char =Type::S8;
22: block → {:1 $1=Code::OpenBlock(); block$6 } =Code::CloseBlock($1);
23: block → {:1 error } =Code::CloseBlock($1);
24: block$6 →
25: block$6 → block$6 stmt
26: @stmt → @:1 $1=Code::OpenBlock(); stmt =Code::CloseBlock($1);
27: @ →
28: stmt → block
29: stmt → break ; Code::Add(Code::Break);
30: stmt → continue ; Code::Add(Code::Continue);
31: stmt → return e_expr:2 ; Code::Add(Code::Return,$2);
32: stmt → input (expr):2 ; Code::Add(Code::Input,$2);
33: stmt → output (expr):2 ; Code::Add(Code::Output,$2);
34: stmt → while (expr):2 @stmt:3 Code::Add(Code::While,$2,$3);
35: stmt → do block:2 while (expr):4 ; Code::Add(Code::Do,$4,$2);
36: stmt → for ( e_expr:3 ; e_expr:5 ; e_expr:7 ) @stmt:9 Code::AddFor($3,$5,$7,$9);
37: stmt → if (expr):2 @stmt:3 Code::AddIf($2,$3,$s2); →
38: stmt → if (expr):2 @stmt:3 else @stmt:5 Code::AddIf($2,$3,$5);
39: stmt → expr:1 ; Code::Add(Code::Expr,$1);
40: stmt → var_dec_list ;
41: stmt → error ;
42: stmt → ;
43: e_expr →
44: e_expr → expr
45: (expr) → ( expr:2 ) =$2
46: (expr) → ( error )
47: expr → num:1 =new Code('0' ,$1 );
48: expr → fnum =new Code('f',0) ;
49: expr → name:1 ( call$7:3 ) =Code::NewCall($1,$3);
50: expr → name ( error )
51: expr → (expr)
52: expr → expr:1 -- =new Code(Code::Dec,$1 );
53: expr → expr:1 ++ =new Code(Code::Inc,$1 );
54: expr → - expr ←
55: expr → ~ expr ←
56: expr → ! expr ←
57: expr → expr:1 + expr:3 =new Code('+' ,$1,$3);
58: expr → expr:1 - expr:3 =new Code('-' ,$1,$3);
59: expr → expr:1 & expr:3 =new Code('&' ,$1,$3);
60: expr → expr:1 | expr:3 =new Code('|' ,$1,$3);
61: expr → expr:1 ^ expr:3 =new Code('^' ,$1,$3);
62: expr → expr:1 * expr:3 =new Code('*' ,$1,$3);
63: expr → expr:1 % expr:3 =new Code('%' ,$1,$3);
64: expr → expr:1 / expr:3 =new Code('/' ,$1,$3);
65: expr → expr:1 < expr:3 =new Code('<' ,$1,$3);
66: expr → expr:1 > expr:3 =new Code('>' ,$1,$3);
67: expr → expr:1 || expr:3 =new Code(Code::Or ,$1,$3);
68: expr → expr:1 && expr:3 =new Code(Code::And,$1,$3);
69: expr → expr:1 << expr:3 =new Code(Code::SL ,$1,$3);
70: expr → expr:1 >> expr:3 =new Code(Code::SR ,$1,$3);
71: expr → expr:1 := expr:3 =new Code('=' ,$1,$3);
72: expr → expr:1 == expr:3 =new Code(Code::Eq ,$1,$3);
73: expr → expr:1 >= expr:3 =new Code(Code::Le ,$1,$3);
74: expr → expr:1 <= expr:3 =new Code(Code::Ge ,$1,$3);
75: expr → expr:1 <> expr:3 =new Code(Code::Ne ,$1,$3);
76: expr → name:1 =new Code('n' ,$1 );
77: expr → expr:1 [ expr:3 ] =new Code('[' ,$1,$3);
78: expr → expr [ error ]
79: expr → expr:1 . name:3 =new Code('.' ,$3,$1);
80: call$8 → expr:1 =new Code(Code::Expr,$1,(Code*)$-);
81: call$8 → expr:1 , call$8:3 =new Code(Code::Expr,$1,(Code*)$3);
82: call$7 →
83: call$7 → call$8
. | name | error | ; | simple_type | var_dec_list | var_name | var_dec_list$4 | all$1 | all | ↓
|
0 | | | | | | | | 1 | 2 | r2 |
1 → (15) | | s9 | | 3 | 4 | | | | | r1 |
2 | | | | | | | | | | r0 |
3 | s11 | | | | | 12 | 13 | | | |
4 | | | s14 | | | | | | | |
5 | r17 | | | | | | | | | r17 |
6 | r18 | | | | | | | | | r18 |
7 | r20 | | | | | | | | | r20 |
8 | r19 | | | | | | | | | r19 |
9 | | r5 | | | | | | | | r5 |
10 | r21 | | | | | | | | | r21
|
. | ( | { | ) | auto | void | int | float | [ | , | char | simple_type | var_name | proc$3 | proc$2 | var_name$5 | ↓
|
11 | s15 | | | | | | | | | | | | | | 16 | r14 |
12 | | | | | | | | | r11 | | | | | | | r11 |
13 | | | | | | | | | s17 | | | | | | | r10 |
14 | | | | r3 | r3 | r3 | r3 | | | r3 | | | | | | r3 |
15 | | | | s5 | s6 | s7 | s8 | | | s10 | 18 | | 19 | 20 | | r8 |
16 | | | r13 | | | | | s21 | r13 | | | | | | | r13 |
17 → (18) | | | | | | | | | | | | 23 | | | | |
18 → (29) | | | | | | | | | | | | 24 | | | | |
19 | | r9 | r9 | | | | | | s25 | | | | | | | r9 |
20 | | <err0> | s26 | | | | | | | | | | | | |
|
. | name | { | ] | } | error | num | simple_type | var_name | block | block$6 | ↓
|
21 | | | | | s27 | s28 | | | | | |
22 → (11) | | | | | | | | | | | r14 |
23 | | | | | | | | | | | r12 |
24 | | | | | | | | | | | r6 |
25 → (15) | | | | | | | 29 | | | | |
26 | | s30 | | | | | | | 31 | | |
27 | | | s32 | | | | | | | | |
28 | | | s33 | | | | | | | | |
29 | s22 | | | | | | | 34 | | | |
30 | | | | <err1> | s35 | | | | | 36 | r24 |
31 | | | | | r4 | | | | | | r4 |
32 | | | | | | | | | | | r16 |
33 | | | | | | | | | | | r15 |
34 | | | | | | | | | | | r7 |
35 | | | | s37 | | | | | | |
|
. | ( | { | } | ) | auto | while | void | return | output | int | input | if | for | float | do | continue | break | error | ; | char | $end | expr | simple_type | var_dec_list | var_name | var_dec_list$4 | block | stmt | ↓
|
36 → (40) | s43 | s30 | s45 | | s5 | s46 | s6 | s47 | s48 | s7 | s49 | s50 | s51 | s8 | s52 | s53 | s54 | s57 | s58 | s10 | <err2> | 38 | 41 | 44 | | | 56 | 60 | |
37 | r23 | r23 | r23 | | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | r23 | | | | | | | | r23 |
38 → (127) | | | | <err3> | | | | | | | | | | | | | | | s86 | | | | | | | | | | |
39 | | | | r48 | | | | | | | | | | | | | | | r48 | | | | | | | | | | r48 |
40 → (43) | s43 | | | | | | | | | | | | | | | | | | | | | 87 | | | | | | | |
41 → (29) | | | | | | | | | | | | | | | | | | | | | | | | | 12 | 13 | | | |
42 | s88 | | | r76 | | | | | | | | | | | | | | | r76 | | | | | | | | | | r76 |
43 → (63) | s43 | | | | | | | | | | | | | | | | | s90 | | | | 89 | | | | | | | |
44 | | | | | | | | | | | | | | | | | | | s91 | | | | | | | | | | |
45 | r22 | r22 | r22 | | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | r22 | | | | | | | | r22
|
. | ( | ; | expr | block | (expr) | e_expr | ↓
|
46 → (48) | s43 | | | | 92 | | |
47 → (98) | s43 | | 93 | | 61 | 94 | r43 |
48 → (50) | s43 | | | | 95 | | |
49 → (48) | s43 | | | | 96 | | |
50 | s43 | | | | 97 | | |
51 | s98 | | | | | | |
52 → (26) | | | | 99 | | | |
53 | | s100 | | | | | |
54 | | s101 | | | | | |
55 → (63) | s43 | | 102 | | 61 | | |
56 | r28 | r28 | | | | | r28 |
57 | | s103 | | | | | |
58 | r42 | r42 | | | | | r42 |
59 | | r47 | | | | | r47 |
60 | r25 | r25 | | | | | r25 |
61 | | r51 | | | | | r51 |
62 → (63) | s43 | | 104 | | 61 | | |
63 → (64) | s43 | | 105 | | 61 | | |
64 → (67) | s43 | | 106 | | 61 | | |
65 → (64) | s43 | | 107 | | 61 | | |
66 → (65) | s43 | | 108 | | 61 | |
|
. | fnum | - | name | ! | num | ~ | expr | (expr) | ↓
|
67 → (50) | s39 | s40 | s42 | s55 | s59 | s62 | 109 | 61 | |
68 → (67) | s39 | s40 | s42 | s55 | s59 | s62 | 110 | 61 | |
69 → (68) | s39 | s40 | s42 | s55 | s59 | s62 | 111 | 61 | |
70 → (69) | s39 | s40 | s42 | s55 | s59 | s62 | 112 | 61 | |
71 → (68) | s39 | s40 | s42 | s55 | s59 | s62 | 113 | 61 | |
72 → (71) | s39 | s40 | s42 | s55 | s59 | s62 | 114 | 61 | |
73 → (71) | s39 | s40 | s42 | s55 | s59 | s62 | 115 | 61 | |
74 | | r52 | | | | | | | r52 |
75 | | r53 | | | | | | | r53 |
76 | | | s116 | | | | | |
|
. | error | expr | call$7 | call$8 | ↓
|
77 → (78) | s118 | 117 | | | |
78 → (68) | | 119 | | | |
79 → (78) | | 120 | | | |
80 → (81) | | 121 | | | |
81 → (83) | | 122 | | | |
82 → (81) | | 123 | | | |
83 → (84) | | 124 | | | |
84 → (78) | | 125 | | | |
85 → (84) | | 126 | | | |
86 | | | | | r39 |
87 | | | | | r54 |
88 → (84) | s128 | 127 | 129 | 130 | r82
|
. | ) | ; | @ | @stmt | e_expr | ↓
|
89 → (127) | s131 | <err0> | | | | |
90 | s132 | | | | | |
91 | | r40 | | | | r40 |
92 → (97) | | | 133 | 134 | | r27 |
93 → (89) | r44 | r44 | | | | r44 |
94 | | s135 | | | | |
95 | | s136 | | | | |
96 | | s137 | | | | |
97 | | | 133 | 138 | | r27 |
98 → (148) | | | | | 139 | r43
|
. | - | + | while | % | / | * | & | | | ^ | ↓
|
99 | | | s140 | | | | | | | |
100 | r30 | | r30 | | | | | | | r30 |
101 | r29 | | r29 | | | | | | | r29 |
102 | r56 | r56 | | r56 | r56 | r56 | r56 | r56 | r56 | r56 |
103 | r41 | | r41 | | | | | | | r41 |
104 | r55 | r55 | | r55 | r55 | r55 | r55 | r55 | r55 | r55 |
105 → (106) | r58 | r58 | | s80 | s81 | s82 | s83 | s84 | s85 | r58 |
106 → (108) | r57 | r57 | | s80 | s81 | s82 | s83 | s84 | s85 | r57 |
107 → (108) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r75 |
108 → (121) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r74 |
109 → (108) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r73 |
110 → (108) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r66 |
111 → (110) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r65 |
112 → (110) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r72 |
113 → (112) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r71 |
114 → (127) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r67 |
115 → (114) | s63 | s64 | | s80 | s81 | s82 | s83 | s84 | s85 | r68 |
116 | r79 | r79 | | r79 | r79 | r79 | r79 | r79 | r79 | r79
|
. | ] | . | [ | >> | << | ↓
|
117 → (38) | s141 | s76 | s77 | s78 | s79 | |
118 | s142 | | | | | |
119 → (120) | r70 | s76 | s77 | r70 | r70 | r70 |
120 | r69 | s76 | s77 | r69 | r69 | r69 |
121 → (120) | r63 | s76 | s77 | s78 | s79 | r63 |
122 → (121) | r64 | s76 | s77 | s78 | s79 | r64 |
123 → (122) | r62 | s76 | s77 | s78 | s79 | r62 |
124 → (108) | r59 | s76 | s77 | s78 | s79 | r59 |
125 → (124) | r60 | s76 | s77 | s78 | s79 | r60 |
126 → (125) | r61 | s76 | s77 | s78 | s79 | r61
|
. | <> | <= | >= | > | < | == | := | || | && | -- | ++ | ) | , | ; | stmt | ↓
|
127 → (110) | s65 | s66 | s67 | s68 | s69 | s70 | s71 | s72 | s73 | s74 | s75 | r80 | s143 | | | r80 |
128 | | | | | | | | | | | | s144 | | | | |
129 | | | | | | | | | | | | s145 | | <err0> | | |
130 | | | | | | | | | | | | r83 | | r83 | | r83 |
131 | r45 | r45 | r45 | r45 | r45 | r45 | r45 | r45 | r45 | r45 | r45 | r45 | r45 | r45 | | r45 |
132 | r46 | r46 | r46 | r46 | r46 | r46 | r46 | r46 | r46 | r46 | r46 | r46 | r46 | r46 | | r46 |
133 → (36) | | | | | | | | | | | | | | s58 | 146 | |
134 | | | | | | | | | | | | | | r34 | | r34 |
135 | | | | | | | | | | | | | | r31 | | r31 |
136 | | | | | | | | | | | | | | r33 | | r33 |
137 | | | | | | | | | | | | | | r32 | | r32
|
. | else | ; | @stmt | (expr) | call$8 | ↓
|
138 | s147 | r37 | | | | r37 |
139 | | s148 | | | | |
140 → (50) | | | | 149 | | |
141 | | r77 | | | | r77 |
142 | | r78 | | | | r78 |
143 → (88) | | | | 61 | 150 | |
144 | | r50 | | | | r50 |
145 | | r49 | | | | r49 |
146 | r26 | r26 | | | | r26 |
147 → (156) | | | 151 | | | r27
|
. | ) | ; | expr | @stmt | e_expr | ↓
|
148 → (88) | | | 93 | | 152 | r43 |
149 | | s153 | | | | |
150 | r81 | | | | | r81 |
151 | | r38 | | | | r38 |
152 | | s154 | | | | |
153 | | r35 | | | | r35 |
154 → (148) | | | 93 | | 155 | r43 |
155 | s156 | | | | | |
156 → (97) | | | | 157 | | r27 |
157 | | r36 | | | | r36
|