3 #define yyparse calc_parse
11 #define yyerror calc_error
15 #define yychar calc_char
19 #define yyval calc_val
23 #define yylval calc_lval
27 #define yydebug calc_debug
31 #define yynerrs calc_nerrs
35 #define yyerrflag calc_errflag
36 #endif /* yyerrflag */
39 #define yylhs calc_lhs
43 #define yylen calc_len
47 #define yydefred calc_defred
51 #define yydgoto calc_dgoto
55 #define yysindex calc_sindex
59 #define yyrindex calc_rindex
63 #define yygindex calc_gindex
67 #define yytable calc_table
71 #define yycheck calc_check
75 #define yyname calc_name
79 #define yyrule calc_rule
81 #define YYPREFIX "calc_"
82 const short calc_lhs[] = { -1,
83 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
84 2, 2, 2, 2, 2, 2, 3, 3,
86 const short calc_len[] = { 2,
87 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
88 3, 3, 3, 2, 1, 1, 1, 2,
90 const short calc_defred[] = { 1,
91 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
92 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
93 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
96 const short calc_dgoto[] = { 1,
99 const short calc_sindex[] = { 0,
100 -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
101 -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
102 -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
105 const short calc_rindex[] = { 0,
106 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
107 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
108 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
111 const short calc_gindex[] = { 0,
114 const short calc_table[] = { 6,
115 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
116 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
117 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
118 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
119 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
120 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
121 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
122 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
123 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
124 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
125 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
126 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
127 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
128 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
129 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
130 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
131 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
132 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
133 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
134 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
135 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
136 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
138 const short calc_check[] = { 40,
139 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
140 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
141 -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
142 -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
143 -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
144 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
145 -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
146 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
147 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
148 -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
149 -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
150 -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
151 -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
152 -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
153 -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
154 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
155 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
156 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
157 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
158 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
159 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
160 -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
166 const char *yyname[] = {
168 "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
169 0,0,0,0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,
170 0,0,0,0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
171 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,
172 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
173 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
174 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
175 0,0,0,0,0,0,"DIGIT","LETTER","UMINUS",
177 const char *yyrule[] = {
180 "list : list stat '\\n'",
181 "list : list error '\\n'",
183 "stat : LETTER '=' expr",
184 "expr : '(' expr ')'",
185 "expr : expr '+' expr",
186 "expr : expr '-' expr",
187 "expr : expr '*' expr",
188 "expr : expr '/' expr",
189 "expr : expr '%' expr",
190 "expr : expr '&' expr",
191 "expr : expr '|' expr",
196 "number : number DIGIT",