2 static char yysccsid
[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
7 #define yyclearin (yychar=(-1))
8 #define yyerrok (yyerrflag=0)
9 #define YYRECOVERING (yyerrflag!=0)
12 /* bc.y: The grammar for a POSIX compatable bc processor with some
13 extensions to the language. */
15 /* This file is part of bc written for MINIX.
16 Copyright (C) 1991, 1992 Free Software Foundation, Inc.
18 This program is free software; you can redistribute it and/or modify
19 it under the terms of the GNU General Public License as published by
20 the Free Software Foundation; either version 2 of the License , or
21 (at your option) any later version.
23 This program is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 GNU General Public License for more details.
28 You should have received a copy of the GNU General Public License
29 along with this program; see the file COPYING. If not, write to
30 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
32 You may contact the author by:
33 e-mail: phil@cs.wwu.edu
34 us-mail: Philip A. Nelson
35 Computer Science Department, 9062
36 Western Washington University
37 Bellingham, WA 98226-9062
39 *************************************************************************/
84 #define UNARY_MINUS 289
87 0, 0, 10, 10, 10, 11, 11, 11, 11, 12,
88 12, 12, 12, 12, 12, 15, 15, 13, 13, 13,
89 13, 13, 13, 13, 13, 13, 13, 16, 17, 18,
90 19, 13, 20, 13, 22, 23, 13, 13, 25, 13,
91 24, 24, 26, 26, 21, 27, 21, 28, 14, 5,
92 5, 6, 6, 6, 7, 7, 7, 7, 8, 8,
93 9, 9, 9, 9, 4, 4, 2, 2, 29, 1,
94 30, 1, 31, 1, 1, 1, 1, 1, 1, 1,
95 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
99 0, 2, 2, 1, 2, 0, 1, 3, 2, 0,
100 1, 2, 3, 2, 3, 1, 2, 1, 1, 1,
101 1, 1, 1, 1, 1, 1, 4, 0, 0, 0,
102 0, 13, 0, 7, 0, 0, 7, 3, 0, 3,
103 1, 3, 1, 1, 0, 0, 3, 0, 12, 0,
104 1, 0, 3, 3, 1, 3, 3, 5, 0, 1,
105 1, 3, 3, 5, 0, 1, 0, 1, 0, 4,
106 0, 4, 0, 4, 2, 3, 3, 3, 3, 3,
107 2, 1, 1, 3, 4, 2, 2, 4, 4, 4,
110 short yydefred
[] = { 1,
111 0, 0, 0, 21, 0, 83, 0, 0, 22, 24,
112 0, 0, 28, 0, 35, 0, 0, 94, 95, 0,
113 18, 25, 97, 23, 39, 19, 0, 0, 0, 0,
114 0, 2, 0, 16, 4, 7, 5, 17, 0, 0,
115 0, 0, 96, 86, 0, 0, 0, 0, 0, 0,
116 0, 0, 0, 0, 81, 0, 0, 0, 11, 71,
117 73, 0, 0, 0, 0, 0, 69, 87, 3, 0,
118 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
119 0, 0, 0, 0, 91, 43, 0, 40, 0, 84,
120 0, 0, 38, 0, 0, 0, 0, 0, 0, 0,
121 0, 8, 0, 85, 0, 93, 0, 0, 0, 88,
122 27, 0, 0, 33, 0, 89, 90, 0, 13, 15,
123 0, 0, 0, 62, 0, 0, 0, 0, 0, 29,
124 0, 0, 42, 0, 56, 0, 0, 0, 0, 0,
125 64, 0, 0, 0, 46, 34, 37, 0, 48, 58,
126 30, 0, 0, 0, 0, 47, 53, 54, 0, 0,
129 short yydgoto
[] = { 1,
130 30, 79, 31, 113, 108, 149, 109, 73, 74, 32,
131 33, 58, 34, 35, 59, 48, 138, 155, 164, 131,
132 146, 50, 132, 88, 54, 89, 152, 154, 101, 94,
135 short yysindex
[] = { 0,
136 -7, 58, 212, 0, -22, 0, -233, -241, 0, 0,
137 -8, -5, 0, -4, 0, 2, 4, 0, 0, 9,
138 0, 0, 0, 0, 0, 0, 212, 212, 91, 725,
139 -240, 0, -29, 0, 0, 0, 0, 0, 84, 245,
140 212, -57, 0, 0, 10, 212, 212, 14, 212, 16,
141 212, 212, 23, 156, 0, 549, 127, -52, 0, 0,
142 0, 212, 212, 212, 212, 212, 0, 0, 0, 91,
143 -17, 725, 24, -3, 578, -205, 562, 725, 27, 212,
144 606, 212, 669, 716, 0, 0, 725, 0, 19, 0,
145 91, 127, 0, 212, 212, -36, -39, -91, -91, -36,
146 212, 0, 166, 0, 277, 0, -21, 36, 40, 0,
147 0, 725, 28, 0, 725, 0, 0, 156, 0, 0,
148 84, 540, -39, 0, -9, 725, -2, -37, -174, 0,
149 127, 48, 0, 346, 0, -167, 3, 212, -185, 127,
150 0, -188, 6, 37, 0, 0, 0, -205, 0, 0,
151 0, 127, -42, 91, 212, 0, 0, 0, -20, 54,
154 short yyrindex
[] = { 0,
155 -16, 0, 0, 0, 409, 0, 0, 0, 0, 0,
156 0, -58, 0, 0, 0, 0, 426, 0, 0, 0,
157 0, 0, 0, 0, 0, 0, 0, 0, -50, 46,
158 470, 0, 0, 0, 0, 0, 0, 0, 661, 56,
159 0, 525, 0, 0, 0, 0, 59, 0, 0, 0,
160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
161 0, 0, 0, 0, 0, 0, 0, 0, 0, -6,
162 705, 7, 0, 60, 0, 61, 0, 63, 0, 49,
163 0, 0, 0, 0, 0, 0, 17, 0, 78, 0,
164 -47, -45, 0, 0, 0, 537, 440, 620, 637, 594,
165 0, 0, 0, 0, 0, 0, -33, 0, 66, 0,
166 0, -19, 0, 0, 68, 0, 0, 0, 0, 0,
167 667, 680, 508, 0, 705, 18, 0, 0, 0, 0,
168 0, 0, 0, 0, 0, 0, -31, 49, -44, 0,
169 0, -40, 0, 0, 0, 0, 0, 0, 0, 0,
170 0, 0, 0, 1, 69, 0, 0, 0, 0, 0,
173 short yygindex
[] = { 0,
174 958, 0, 104, -118, 0, 0, -35, 0, 0, 0,
175 0, -34, 22, 0, 15, 0, 0, 0, 0, 0,
176 0, 0, 0, -1, 0, 0, 0, 0, 0, 0,
179 #define YYTABLESIZE 1113
180 short yytable
[] = { 52,
181 26, 129, 66, 64, 52, 65, 92, 55, 10, 57,
182 55, 12, 57, 14, 45, 36, 158, 40, 52, 144,
183 45, 66, 40, 38, 67, 55, 68, 57, 42, 70,
184 40, 46, 28, 41, 47, 49, 160, 27, 92, 66,
185 105, 51, 6, 52, 43, 18, 19, 61, 53, 76,
186 61, 23, 9, 80, 66, 82, 107, 66, 63, 10,
187 44, 63, 118, 85, 104, 28, 26, 111, 41, 127,
188 27, 12, 93, 103, 10, 44, 128, 12, 38, 14,
189 45, 134, 52, 129, 102, 136, 130, 137, 140, 142,
190 135, 145, 148, 143, 162, 151, 59, 28, 150, 67,
191 60, 50, 27, 68, 20, 119, 51, 65, 36, 65,
192 44, 0, 153, 120, 0, 29, 133, 0, 0, 159,
193 0, 0, 0, 0, 0, 0, 64, 0, 65, 0,
194 28, 0, 0, 0, 0, 27, 41, 0, 0, 0,
195 0, 44, 0, 0, 0, 0, 0, 0, 29, 0,
196 163, 0, 139, 0, 0, 0, 0, 0, 0, 0,
197 0, 147, 0, 0, 0, 0, 28, 0, 0, 0,
198 20, 27, 62, 156, 0, 119, 0, 66, 0, 0,
199 29, 0, 0, 0, 0, 165, 0, 0, 0, 0,
200 0, 0, 0, 0, 0, 28, 0, 0, 26, 0,
201 27, 0, 41, 0, 91, 28, 10, 0, 0, 12,
202 27, 14, 45, 29, 157, 52, 52, 0, 26, 52,
203 52, 52, 52, 55, 62, 57, 52, 69, 52, 52,
204 52, 52, 52, 52, 52, 52, 161, 52, 52, 52,
205 6, 52, 52, 52, 52, 52, 52, 52, 2, 29,
206 9, 28, 3, 4, 5, 6, 27, 10, 124, 7,
207 8, 9, 10, 11, 12, 13, 14, 15, 16, 12,
208 17, 18, 19, 44, 20, 21, 22, 23, 24, 25,
209 26, 57, 0, 0, 28, 3, 4, 5, 6, 27,
210 0, 0, 7, 44, 9, 10, 11, 12, 13, 14,
211 15, 16, 20, 17, 18, 19, 0, 20, 21, 22,
212 23, 24, 25, 26, 37, 0, 28, 3, 4, 5,
213 6, 27, 20, 0, 7, 0, 9, 10, 11, 12,
214 13, 14, 15, 16, 41, 17, 18, 19, 0, 20,
215 21, 22, 23, 24, 25, 26, 57, 62, 0, 63,
216 3, 4, 5, 6, 41, 0, 0, 7, 0, 9,
217 10, 11, 12, 13, 14, 15, 16, 0, 17, 18,
218 19, 0, 20, 21, 22, 23, 24, 25, 26, 0,
219 0, 0, 0, 0, 0, 28, 3, 4, 5, 6,
220 27, 0, 0, 7, 0, 9, 10, 11, 12, 13,
221 14, 15, 16, 0, 17, 18, 19, 0, 20, 21,
222 22, 23, 24, 25, 26, 3, 86, 5, 6, 0,
223 0, 0, 7, 0, 0, 3, 11, 5, 6, 0,
224 0, 16, 7, 17, 18, 19, 11, 20, 141, 0,
225 23, 16, 0, 17, 18, 19, 0, 20, 0, 92,
226 23, 92, 92, 92, 0, 0, 0, 0, 0, 0,
227 0, 0, 0, 0, 0, 0, 96, 92, 96, 96,
228 96, 3, 0, 5, 6, 0, 0, 0, 7, 0,
229 76, 0, 11, 76, 96, 0, 0, 16, 0, 17,
230 18, 19, 0, 20, 0, 0, 23, 0, 76, 0,
231 0, 92, 92, 0, 3, 0, 71, 6, 0, 0,
232 82, 7, 82, 82, 82, 11, 0, 0, 96, 96,
233 16, 0, 17, 18, 19, 0, 20, 0, 82, 23,
234 0, 0, 76, 92, 0, 0, 3, 0, 125, 6,
235 0, 0, 0, 7, 0, 0, 0, 11, 70, 0,
236 96, 70, 16, 0, 17, 18, 19, 0, 20, 0,
237 0, 23, 82, 82, 76, 92, 70, 92, 92, 92,
238 0, 0, 0, 0, 0, 0, 0, 79, 0, 79,
239 79, 79, 64, 92, 65, 0, 0, 0, 0, 90,
240 0, 64, 0, 65, 82, 79, 0, 0, 0, 0,
241 70, 0, 110, 0, 64, 3, 65, 5, 6, 0,
242 0, 0, 7, 0, 0, 0, 11, 92, 92, 0,
243 64, 16, 65, 17, 18, 19, 0, 20, 0, 79,
244 23, 0, 70, 66, 80, 0, 80, 80, 80, 0,
245 0, 0, 66, 0, 0, 0, 114, 0, 64, 92,
246 65, 0, 80, 0, 0, 66, 0, 0, 0, 0,
247 77, 79, 77, 77, 77, 92, 92, 92, 0, 0,
248 106, 66, 92, 92, 92, 92, 0, 78, 77, 78,
249 78, 78, 96, 96, 96, 92, 80, 0, 0, 96,
250 96, 96, 96, 0, 0, 78, 76, 76, 76, 66,
251 0, 75, 96, 0, 75, 76, 0, 72, 0, 116,
252 72, 64, 77, 65, 0, 0, 76, 0, 80, 75,
253 74, 0, 0, 74, 0, 72, 82, 82, 82, 78,
254 0, 0, 0, 82, 0, 82, 0, 0, 74, 0,
255 0, 0, 0, 0, 77, 92, 82, 92, 92, 92,
256 0, 0, 0, 75, 0, 0, 117, 0, 64, 72,
257 65, 78, 66, 0, 70, 70, 70, 64, 0, 65,
258 0, 0, 74, 70, 0, 0, 0, 0, 0, 0,
259 0, 92, 92, 92, 70, 75, 0, 0, 92, 0,
260 92, 72, 0, 79, 79, 79, 0, 60, 92, 0,
261 79, 92, 79, 62, 74, 63, 60, 61, 0, 66,
262 0, 0, 62, 79, 63, 0, 0, 0, 66, 60,
263 61, 0, 0, 0, 0, 62, 0, 63, 0, 0,
264 0, 0, 0, 0, 0, 60, 61, 0, 0, 0,
265 0, 62, 0, 63, 0, 0, 0, 0, 0, 0,
266 80, 80, 80, 0, 0, 0, 0, 80, 0, 80,
267 0, 0, 0, 60, 61, 0, 0, 0, 0, 62,
268 80, 63, 0, 0, 0, 0, 77, 77, 77, 0,
269 0, 0, 0, 0, 0, 77, 0, 0, 0, 0,
270 0, 0, 0, 78, 78, 78, 77, 0, 0, 0,
271 0, 0, 78, 0, 0, 0, 0, 0, 0, 0,
272 0, 0, 0, 78, 0, 0, 0, 75, 75, 75,
273 0, 0, 0, 72, 72, 72, 60, 61, 0, 0,
274 0, 0, 62, 0, 63, 0, 74, 75, 74, 0,
275 0, 0, 0, 72, 0, 0, 0, 0, 0, 0,
276 0, 0, 0, 0, 0, 0, 74, 0, 0, 0,
277 39, 0, 92, 92, 0, 0, 0, 0, 92, 92,
278 92, 92, 0, 60, 61, 0, 0, 0, 0, 62,
279 0, 63, 60, 61, 55, 56, 0, 0, 62, 0,
280 63, 0, 0, 0, 0, 0, 0, 72, 75, 0,
281 0, 0, 0, 77, 78, 0, 81, 0, 83, 84,
282 0, 87, 0, 0, 0, 0, 0, 0, 0, 96,
283 97, 98, 99, 100, 0, 0, 0, 0, 0, 0,
284 0, 0, 0, 0, 0, 0, 0, 112, 0, 115,
285 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
286 0, 121, 122, 0, 0, 0, 0, 0, 123, 0,
287 75, 0, 126, 0, 0, 0, 0, 0, 0, 0,
288 0, 0, 0, 0, 0, 87, 0, 0, 0, 0,
289 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
290 0, 75, 0, 0, 0, 112, 0, 0, 0, 0,
291 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
294 short yycheck
[] = { 40,
295 59, 44, 94, 43, 45, 45, 59, 41, 59, 41,
296 44, 59, 44, 59, 59, 1, 59, 40, 59, 138,
297 262, 41, 40, 2, 265, 59, 267, 59, 262, 59,
298 40, 40, 40, 91, 40, 40, 155, 45, 59, 59,
299 44, 40, 59, 40, 278, 279, 280, 41, 40, 40,
300 44, 285, 59, 40, 94, 40, 262, 94, 41, 59,
301 44, 44, 44, 41, 41, 40, 125, 41, 91, 91,
302 45, 59, 125, 91, 125, 59, 41, 125, 57, 125,
303 125, 91, 123, 44, 70, 123, 59, 262, 41, 257,
304 93, 277, 281, 91, 41, 59, 41, 40, 93, 41,
305 41, 41, 45, 41, 59, 91, 41, 59, 41, 41,
306 7, -1, 148, 92, -1, 123, 118, -1, -1, 154,
307 -1, -1, -1, -1, -1, -1, 43, -1, 45, -1,
308 40, -1, -1, -1, -1, 45, 59, -1, -1, -1,
309 -1, 125, -1, -1, -1, -1, -1, -1, 123, -1,
310 125, -1, 131, -1, -1, -1, -1, -1, -1, -1,
311 -1, 140, -1, -1, -1, -1, 40, -1, -1, -1,
312 125, 45, 264, 152, -1, 161, -1, 94, -1, -1,
313 123, -1, -1, -1, -1, 164, -1, -1, -1, -1,
314 -1, -1, -1, -1, -1, 40, -1, -1, 257, -1,
315 45, -1, 125, -1, 257, 40, 257, -1, -1, 257,
316 45, 257, 257, 123, 257, 256, 257, -1, 277, 260,
317 261, 262, 263, 257, 264, 257, 267, 257, 269, 270,
318 271, 272, 273, 274, 275, 276, 257, 278, 279, 280,
319 257, 282, 283, 284, 285, 286, 287, 288, 256, 123,
320 257, 40, 260, 261, 262, 263, 45, 257, 93, 267,
321 268, 269, 270, 271, 272, 273, 274, 275, 276, 257,
322 278, 279, 280, 257, 282, 283, 284, 285, 286, 287,
323 288, 256, -1, -1, 40, 260, 261, 262, 263, 45,
324 -1, -1, 267, 277, 269, 270, 271, 272, 273, 274,
325 275, 276, 257, 278, 279, 280, -1, 282, 283, 284,
326 285, 286, 287, 288, 257, -1, 40, 260, 261, 262,
327 263, 45, 277, -1, 267, -1, 269, 270, 271, 272,
328 273, 274, 275, 276, 257, 278, 279, 280, -1, 282,
329 283, 284, 285, 286, 287, 288, 256, 264, -1, 266,
330 260, 261, 262, 263, 277, -1, -1, 267, -1, 269,
331 270, 271, 272, 273, 274, 275, 276, -1, 278, 279,
332 280, -1, 282, 283, 284, 285, 286, 287, 288, -1,
333 -1, -1, -1, -1, -1, 40, 260, 261, 262, 263,
334 45, -1, -1, 267, -1, 269, 270, 271, 272, 273,
335 274, 275, 276, -1, 278, 279, 280, -1, 282, 283,
336 284, 285, 286, 287, 288, 260, 261, 262, 263, -1,
337 -1, -1, 267, -1, -1, 260, 271, 262, 263, -1,
338 -1, 276, 267, 278, 279, 280, 271, 282, 93, -1,
339 285, 276, -1, 278, 279, 280, -1, 282, -1, 41,
340 285, 43, 44, 45, -1, -1, -1, -1, -1, -1,
341 -1, -1, -1, -1, -1, -1, 41, 59, 43, 44,
342 45, 260, -1, 262, 263, -1, -1, -1, 267, -1,
343 41, -1, 271, 44, 59, -1, -1, 276, -1, 278,
344 279, 280, -1, 282, -1, -1, 285, -1, 59, -1,
345 -1, 93, 94, -1, 260, -1, 262, 263, -1, -1,
346 41, 267, 43, 44, 45, 271, -1, -1, 93, 94,
347 276, -1, 278, 279, 280, -1, 282, -1, 59, 285,
348 -1, -1, 93, 125, -1, -1, 260, -1, 262, 263,
349 -1, -1, -1, 267, -1, -1, -1, 271, 41, -1,
350 125, 44, 276, -1, 278, 279, 280, -1, 282, -1,
351 -1, 285, 93, 94, 125, 41, 59, 43, 44, 45,
352 -1, -1, -1, -1, -1, -1, -1, 41, -1, 43,
353 44, 45, 43, 59, 45, -1, -1, -1, -1, 41,
354 -1, 43, -1, 45, 125, 59, -1, -1, -1, -1,
355 93, -1, 41, -1, 43, 260, 45, 262, 263, -1,
356 -1, -1, 267, -1, -1, -1, 271, 93, 94, -1,
357 43, 276, 45, 278, 279, 280, -1, 282, -1, 93,
358 285, -1, 125, 94, 41, -1, 43, 44, 45, -1,
359 -1, -1, 94, -1, -1, -1, 41, -1, 43, 125,
360 45, -1, 59, -1, -1, 94, -1, -1, -1, -1,
361 41, 125, 43, 44, 45, 257, 258, 259, -1, -1,
362 93, 94, 264, 265, 266, 267, -1, 41, 59, 43,
363 44, 45, 257, 258, 259, 277, 93, -1, -1, 264,
364 265, 266, 267, -1, -1, 59, 257, 258, 259, 94,
365 -1, 41, 277, -1, 44, 266, -1, 41, -1, 41,
366 44, 43, 93, 45, -1, -1, 277, -1, 125, 59,
367 41, -1, -1, 44, -1, 59, 257, 258, 259, 93,
368 -1, -1, -1, 264, -1, 266, -1, -1, 59, -1,
369 -1, -1, -1, -1, 125, 41, 277, 43, 44, 45,
370 -1, -1, -1, 93, -1, -1, 41, -1, 43, 93,
371 45, 125, 94, -1, 257, 258, 259, 43, -1, 45,
372 -1, -1, 93, 266, -1, -1, -1, -1, -1, -1,
373 -1, 257, 258, 259, 277, 125, -1, -1, 264, -1,
374 266, 125, -1, 257, 258, 259, -1, 258, 94, -1,
375 264, 277, 266, 264, 125, 266, 258, 259, -1, 94,
376 -1, -1, 264, 277, 266, -1, -1, -1, 94, 258,
377 259, -1, -1, -1, -1, 264, -1, 266, -1, -1,
378 -1, -1, -1, -1, -1, 258, 259, -1, -1, -1,
379 -1, 264, -1, 266, -1, -1, -1, -1, -1, -1,
380 257, 258, 259, -1, -1, -1, -1, 264, -1, 266,
381 -1, -1, -1, 258, 259, -1, -1, -1, -1, 264,
382 277, 266, -1, -1, -1, -1, 257, 258, 259, -1,
383 -1, -1, -1, -1, -1, 266, -1, -1, -1, -1,
384 -1, -1, -1, 257, 258, 259, 277, -1, -1, -1,
385 -1, -1, 266, -1, -1, -1, -1, -1, -1, -1,
386 -1, -1, -1, 277, -1, -1, -1, 257, 258, 259,
387 -1, -1, -1, 257, 258, 259, 258, 259, -1, -1,
388 -1, -1, 264, -1, 266, -1, 257, 277, 259, -1,
389 -1, -1, -1, 277, -1, -1, -1, -1, -1, -1,
390 -1, -1, -1, -1, -1, -1, 277, -1, -1, -1,
391 3, -1, 258, 259, -1, -1, -1, -1, 264, 265,
392 266, 267, -1, 258, 259, -1, -1, -1, -1, 264,
393 -1, 266, 258, 259, 27, 28, -1, -1, 264, -1,
394 266, -1, -1, -1, -1, -1, -1, 40, 41, -1,
395 -1, -1, -1, 46, 47, -1, 49, -1, 51, 52,
396 -1, 54, -1, -1, -1, -1, -1, -1, -1, 62,
397 63, 64, 65, 66, -1, -1, -1, -1, -1, -1,
398 -1, -1, -1, -1, -1, -1, -1, 80, -1, 82,
399 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
400 -1, 94, 95, -1, -1, -1, -1, -1, 101, -1,
401 103, -1, 105, -1, -1, -1, -1, -1, -1, -1,
402 -1, -1, -1, -1, -1, 118, -1, -1, -1, -1,
403 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
404 -1, 134, -1, -1, -1, 138, -1, -1, -1, -1,
405 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
412 #define YYMAXTOKEN 289
415 "end-of-file",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,
416 0,0,0,0,0,0,"'('","')'",0,"'+'","','","'-'",0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,0,
417 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,
418 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,
419 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,
420 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,
421 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,
422 0,0,0,0,0,"NEWLINE","AND","OR","NOT","STRING","NAME","NUMBER","MUL_OP",
423 "ASSIGN_OP","REL_OP","INCR_DECR","Define","Break","Quit","Length","Return",
424 "For","If","While","Sqrt","Else","Scale","Ibase","Obase","Auto","Read",
425 "Warranty","Halt","Last","Continue","Print","Limits","UNARY_MINUS",
430 "program : program input_item",
431 "input_item : semicolon_list NEWLINE",
432 "input_item : function",
433 "input_item : error NEWLINE",
435 "semicolon_list : statement_or_error",
436 "semicolon_list : semicolon_list ';' statement_or_error",
437 "semicolon_list : semicolon_list ';'",
439 "statement_list : statement_or_error",
440 "statement_list : statement_list NEWLINE",
441 "statement_list : statement_list NEWLINE statement_or_error",
442 "statement_list : statement_list ';'",
443 "statement_list : statement_list ';' statement",
444 "statement_or_error : statement",
445 "statement_or_error : error statement",
446 "statement : Warranty",
447 "statement : Limits",
448 "statement : expression",
449 "statement : STRING",
451 "statement : Continue",
454 "statement : Return",
455 "statement : Return '(' return_expression ')'",
460 "statement : For $$1 '(' opt_expression ';' $$2 opt_expression ';' $$3 opt_expression ')' $$4 statement",
462 "statement : If '(' expression ')' $$5 statement opt_else",
465 "statement : While $$6 '(' expression $$7 ')' statement",
466 "statement : '{' statement_list '}'",
468 "statement : Print $$8 print_list",
469 "print_list : print_element",
470 "print_list : print_element ',' print_list",
471 "print_element : STRING",
472 "print_element : expression",
475 "opt_else : Else $$9 statement",
477 "function : Define NAME '(' opt_parameter_list ')' '{' NEWLINE opt_auto_define_list $$10 statement_list NEWLINE '}'",
478 "opt_parameter_list :",
479 "opt_parameter_list : define_list",
480 "opt_auto_define_list :",
481 "opt_auto_define_list : Auto define_list NEWLINE",
482 "opt_auto_define_list : Auto define_list ';'",
483 "define_list : NAME",
484 "define_list : NAME '[' ']'",
485 "define_list : define_list ',' NAME",
486 "define_list : define_list ',' NAME '[' ']'",
487 "opt_argument_list :",
488 "opt_argument_list : argument_list",
489 "argument_list : expression",
490 "argument_list : NAME '[' ']'",
491 "argument_list : argument_list ',' expression",
492 "argument_list : argument_list ',' NAME '[' ']'",
494 "opt_expression : expression",
495 "return_expression :",
496 "return_expression : expression",
498 "expression : named_expression ASSIGN_OP $$11 expression",
500 "expression : expression AND $$12 expression",
502 "expression : expression OR $$13 expression",
503 "expression : NOT expression",
504 "expression : expression REL_OP expression",
505 "expression : expression '+' expression",
506 "expression : expression '-' expression",
507 "expression : expression MUL_OP expression",
508 "expression : expression '^' expression",
509 "expression : '-' expression",
510 "expression : named_expression",
511 "expression : NUMBER",
512 "expression : '(' expression ')'",
513 "expression : NAME '(' opt_argument_list ')'",
514 "expression : INCR_DECR named_expression",
515 "expression : named_expression INCR_DECR",
516 "expression : Length '(' expression ')'",
517 "expression : Sqrt '(' expression ')'",
518 "expression : Scale '(' expression ')'",
519 "expression : Read '(' ')'",
520 "named_expression : NAME",
521 "named_expression : NAME '[' expression ']'",
522 "named_expression : Ibase",
523 "named_expression : Obase",
524 "named_expression : Scale",
525 "named_expression : Last",
530 #define YYMAXDEPTH YYSTACKSIZE
533 #define YYSTACKSIZE YYMAXDEPTH
535 #define YYSTACKSIZE 500
536 #define YYMAXDEPTH 500
547 short yyss
[YYSTACKSIZE
];
548 YYSTYPE yyvs
[YYSTACKSIZE
];
549 #define yystacksize YYSTACKSIZE
550 #define YYABORT goto yyabort
551 #define YYREJECT goto yyabort
552 #define YYACCEPT goto yyaccept
553 #define YYERROR goto yyerrlab
557 register int yym
, yyn
, yystate
;
560 extern char *getenv();
562 if (yys
= getenv("YYDEBUG"))
565 if (yyn
>= '0' && yyn
<= '9')
576 *yyssp
= yystate
= 0;
579 if (yyn
= yydefred
[yystate
]) goto yyreduce
;
582 if ((yychar
= yylex()) < 0) yychar
= 0;
587 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
588 if (!yys
) yys
= "illegal-symbol";
589 printf("%sdebug: state %d, reading %d (%s)\n",
590 YYPREFIX
, yystate
, yychar
, yys
);
594 if ((yyn
= yysindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
595 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
599 printf("%sdebug: state %d, shifting to state %d\n",
600 YYPREFIX
, yystate
, yytable
[yyn
]);
602 if (yyssp
>= yyss
+ yystacksize
- 1)
606 *++yyssp
= yystate
= yytable
[yyn
];
609 if (yyerrflag
> 0) --yyerrflag
;
612 if ((yyn
= yyrindex
[yystate
]) && (yyn
+= yychar
) >= 0 &&
613 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yychar
)
618 if (yyerrflag
) goto yyinrecovery
;
623 yyerror("syntax error");
635 if ((yyn
= yysindex
[*yyssp
]) && (yyn
+= YYERRCODE
) >= 0 &&
636 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == YYERRCODE
)
640 printf("%sdebug: state %d, error recovery shifting\
641 to state %d\n", YYPREFIX
, *yyssp
, yytable
[yyn
]);
643 if (yyssp
>= yyss
+ yystacksize
- 1)
647 *++yyssp
= yystate
= yytable
[yyn
];
655 printf("%sdebug: error recovery discarding state %d\n",
658 if (yyssp
<= yyss
) goto yyabort
;
666 if (yychar
== 0) goto yyabort
;
671 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
672 if (!yys
) yys
= "illegal-symbol";
673 printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
674 YYPREFIX
, yystate
, yychar
, yys
);
683 printf("%sdebug: state %d, reducing by rule %d (%s)\n",
684 YYPREFIX
, yystate
, yyn
, yyrule
[yyn
]);
687 yyval
= yyvsp
[1-yym
];
696 printf ("%s\n", BC_VERSION
);
718 { yyval
.i_value
= 0; }
722 { yyval
.i_value
= 0; }
726 { yyval
.i_value
= yyvsp
[0].i_value
; }
739 if (yyvsp
[0].i_value
& 2)
740 warn ("comparison in expression");
741 if (yyvsp
[0].i_value
& 1)
752 generate (yyvsp
[0].s_value
);
753 free (yyvsp
[0].s_value
);
759 if (break_label
== 0)
760 yyerror ("Break outside a for/while");
763 sprintf (genstr
, "J%1d:", break_label
);
771 warn ("Continue statement");
772 if (continue_label
== 0)
773 yyerror ("Continue outside a for");
776 sprintf (genstr
, "J%1d:", continue_label
);
800 yyvsp
[0].i_value
= break_label
;
801 break_label
= next_label
++;
807 if (yyvsp
[-1].i_value
> 1)
808 warn ("Comparison in first for expression");
809 yyvsp
[-1].i_value
= next_label
++;
810 if (yyvsp
[-1].i_value
< 0)
811 sprintf (genstr
, "N%1d:", yyvsp
[-1].i_value
);
813 sprintf (genstr
, "pN%1d:", yyvsp
[-1].i_value
);
820 if (yyvsp
[-1].i_value
< 0) generate ("1");
821 yyvsp
[-1].i_value
= next_label
++;
822 sprintf (genstr
, "B%1d:J%1d:", yyvsp
[-1].i_value
, break_label
);
824 yyval
.i_value
= continue_label
;
825 continue_label
= next_label
++;
826 sprintf (genstr
, "N%1d:", continue_label
);
833 if (yyvsp
[-1].i_value
> 1)
834 warn ("Comparison in third for expression");
835 if (yyvsp
[-1].i_value
< 0)
836 sprintf (genstr
, "J%1d:N%1d:", yyvsp
[-7].i_value
, yyvsp
[-4].i_value
);
838 sprintf (genstr
, "pJ%1d:N%1d:", yyvsp
[-7].i_value
, yyvsp
[-4].i_value
);
845 sprintf (genstr
, "J%1d:N%1d:",
846 continue_label
, break_label
);
848 break_label
= yyvsp
[-12].i_value
;
849 continue_label
= yyvsp
[-4].i_value
;
855 yyvsp
[-1].i_value
= if_label
;
856 if_label
= next_label
++;
857 sprintf (genstr
, "Z%1d:", if_label
);
864 sprintf (genstr
, "N%1d:", if_label
);
866 if_label
= yyvsp
[-4].i_value
;
872 yyvsp
[0].i_value
= next_label
++;
873 sprintf (genstr
, "N%1d:", yyvsp
[0].i_value
);
880 yyvsp
[0].i_value
= break_label
;
881 break_label
= next_label
++;
882 sprintf (genstr
, "Z%1d:", break_label
);
889 sprintf (genstr
, "J%1d:N%1d:", yyvsp
[-6].i_value
, break_label
);
891 break_label
= yyvsp
[-3].i_value
;
896 { yyval
.i_value
= 0; }
900 { warn ("print statement"); }
906 generate (yyvsp
[0].s_value
);
907 free (yyvsp
[0].s_value
);
917 warn ("else clause in if statement");
918 yyvsp
[0].i_value
= next_label
++;
919 sprintf (genstr
, "J%d:N%1d:", yyvsp
[0].i_value
, if_label
);
921 if_label
= yyvsp
[0].i_value
;
927 /* Check auto list against parameter list? */
928 check_params (yyvsp
[-4].a_value
,yyvsp
[0].a_value
);
929 sprintf (genstr
, "F%d,%s.%s[", lookup(yyvsp
[-6].s_value
,FUNCT
),
930 arg_str (yyvsp
[-4].a_value
,TRUE
), arg_str (yyvsp
[0].a_value
,TRUE
));
932 free_args (yyvsp
[-4].a_value
);
933 free_args (yyvsp
[0].a_value
);
934 yyvsp
[-7].i_value
= next_label
;
942 next_label
= yyvsp
[-11].i_value
;
947 { yyval
.a_value
= NULL
; }
951 { yyval
.a_value
= NULL
; }
955 { yyval
.a_value
= yyvsp
[-1].a_value
; }
959 { yyval
.a_value
= yyvsp
[-1].a_value
; }
963 { yyval
.a_value
= nextarg (NULL
, lookup (yyvsp
[0].s_value
,SIMPLE
)); }
967 { yyval
.a_value
= nextarg (NULL
, lookup (yyvsp
[-2].s_value
,ARRAY
)); }
971 { yyval
.a_value
= nextarg (yyvsp
[-2].a_value
, lookup (yyvsp
[0].s_value
,SIMPLE
)); }
975 { yyval
.a_value
= nextarg (yyvsp
[-4].a_value
, lookup (yyvsp
[-2].s_value
,ARRAY
)); }
979 { yyval
.a_value
= NULL
; }
984 if (yyvsp
[0].i_value
> 1) warn ("comparison in argument");
985 yyval
.a_value
= nextarg (NULL
,0);
991 sprintf (genstr
, "K%d:", -lookup (yyvsp
[-2].s_value
,ARRAY
));
993 yyval
.a_value
= nextarg (NULL
,1);
999 if (yyvsp
[0].i_value
> 1) warn ("comparison in argument");
1000 yyval
.a_value
= nextarg (yyvsp
[-2].a_value
,0);
1006 sprintf (genstr
, "K%d:", -lookup (yyvsp
[-2].s_value
,ARRAY
));
1008 yyval
.a_value
= nextarg (yyvsp
[-4].a_value
,1);
1015 warn ("Missing expression in for statement");
1028 if (yyvsp
[0].i_value
> 1)
1029 warn ("comparison in return expresion");
1035 if (yyvsp
[0].c_value
!= '=')
1037 if (yyvsp
[-1].i_value
< 0)
1038 sprintf (genstr
, "DL%d:", -yyvsp
[-1].i_value
);
1040 sprintf (genstr
, "l%d:", yyvsp
[-1].i_value
);
1048 if (yyvsp
[0].i_value
> 1) warn("comparison in assignment");
1049 if (yyvsp
[-2].c_value
!= '=')
1051 sprintf (genstr
, "%c", yyvsp
[-2].c_value
);
1054 if (yyvsp
[-3].i_value
< 0)
1055 sprintf (genstr
, "S%d:", -yyvsp
[-3].i_value
);
1057 sprintf (genstr
, "s%d:", yyvsp
[-3].i_value
);
1065 warn("&& operator");
1066 yyvsp
[0].i_value
= next_label
++;
1067 sprintf (genstr
, "DZ%d:p", yyvsp
[0].i_value
);
1074 sprintf (genstr
, "DZ%d:p1N%d:", yyvsp
[-2].i_value
, yyvsp
[-2].i_value
);
1076 yyval
.i_value
= yyvsp
[-3].i_value
| yyvsp
[0].i_value
;
1082 warn("|| operator");
1083 yyvsp
[0].i_value
= next_label
++;
1084 sprintf (genstr
, "B%d:", yyvsp
[0].i_value
);
1092 tmplab
= next_label
++;
1093 sprintf (genstr
, "B%d:0J%d:N%d:1N%d:",
1094 yyvsp
[-2].i_value
, tmplab
, yyvsp
[-2].i_value
, tmplab
);
1096 yyval
.i_value
= yyvsp
[-3].i_value
| yyvsp
[0].i_value
;
1102 yyval
.i_value
= yyvsp
[0].i_value
;
1111 switch (*(yyvsp
[-1].s_value
))
1122 if (yyvsp
[-1].s_value
[1] == '=')
1129 if (yyvsp
[-1].s_value
[1] == '=')
1141 yyval
.i_value
= yyvsp
[-2].i_value
| yyvsp
[0].i_value
;
1148 yyval
.i_value
= yyvsp
[-2].i_value
| yyvsp
[0].i_value
;
1154 genstr
[0] = yyvsp
[-1].c_value
;
1157 yyval
.i_value
= yyvsp
[-2].i_value
| yyvsp
[0].i_value
;
1164 yyval
.i_value
= yyvsp
[-2].i_value
| yyvsp
[0].i_value
;
1171 yyval
.i_value
= yyvsp
[0].i_value
;
1178 if (yyvsp
[0].i_value
< 0)
1179 sprintf (genstr
, "L%d:", -yyvsp
[0].i_value
);
1181 sprintf (genstr
, "l%d:", yyvsp
[0].i_value
);
1188 int len
= strlen(yyvsp
[0].s_value
);
1190 if (len
== 1 && *yyvsp
[0].s_value
== '0')
1192 else if (len
== 1 && *yyvsp
[0].s_value
== '1')
1197 generate (yyvsp
[0].s_value
);
1200 free (yyvsp
[0].s_value
);
1205 { yyval
.i_value
= yyvsp
[-1].i_value
| 1; }
1211 if (yyvsp
[-1].a_value
!= NULL
)
1213 sprintf (genstr
, "C%d,%s:",
1214 lookup (yyvsp
[-3].s_value
,FUNCT
),
1215 arg_str (yyvsp
[-1].a_value
,FALSE
));
1216 free_args (yyvsp
[-1].a_value
);
1220 sprintf (genstr
, "C%d:", lookup (yyvsp
[-3].s_value
,FUNCT
));
1229 if (yyvsp
[0].i_value
< 0)
1231 if (yyvsp
[-1].c_value
== '+')
1232 sprintf (genstr
, "DA%d:L%d:", -yyvsp
[0].i_value
, -yyvsp
[0].i_value
);
1234 sprintf (genstr
, "DM%d:L%d:", -yyvsp
[0].i_value
, -yyvsp
[0].i_value
);
1238 if (yyvsp
[-1].c_value
== '+')
1239 sprintf (genstr
, "i%d:l%d:", yyvsp
[0].i_value
, yyvsp
[0].i_value
);
1241 sprintf (genstr
, "d%d:l%d:", yyvsp
[0].i_value
, yyvsp
[0].i_value
);
1250 if (yyvsp
[-1].i_value
< 0)
1252 sprintf (genstr
, "DL%d:x", -yyvsp
[-1].i_value
);
1254 if (yyvsp
[0].c_value
== '+')
1255 sprintf (genstr
, "A%d:", -yyvsp
[-1].i_value
);
1257 sprintf (genstr
, "M%d:", -yyvsp
[-1].i_value
);
1261 sprintf (genstr
, "l%d:", yyvsp
[-1].i_value
);
1263 if (yyvsp
[0].c_value
== '+')
1264 sprintf (genstr
, "i%d:", yyvsp
[-1].i_value
);
1266 sprintf (genstr
, "d%d:", yyvsp
[-1].i_value
);
1273 { generate ("cL"); yyval
.i_value
= 1;}
1277 { generate ("cR"); yyval
.i_value
= 1;}
1281 { generate ("cS"); yyval
.i_value
= 1;}
1286 warn ("read function");
1287 generate ("cI"); yyval
.i_value
= 1;
1292 { yyval
.i_value
= lookup(yyvsp
[0].s_value
,SIMPLE
); }
1297 if (yyvsp
[-1].i_value
> 1) warn("comparison in subscript");
1298 yyval
.i_value
= lookup(yyvsp
[-3].s_value
,ARRAY
);
1303 { yyval
.i_value
= 0; }
1307 { yyval
.i_value
= 1; }
1311 { yyval
.i_value
= 2; }
1315 { yyval
.i_value
= 3; }
1317 #line 1318 "y.tab.c"
1323 if (yystate
== 0 && yym
== 0)
1327 printf("%sdebug: after reduction, shifting from state 0 to\
1328 state %d\n", YYPREFIX
, YYFINAL
);
1335 if ((yychar
= yylex()) < 0) yychar
= 0;
1340 if (yychar
<= YYMAXTOKEN
) yys
= yyname
[yychar
];
1341 if (!yys
) yys
= "illegal-symbol";
1342 printf("%sdebug: state %d, reading %d (%s)\n",
1343 YYPREFIX
, YYFINAL
, yychar
, yys
);
1347 if (yychar
== 0) goto yyaccept
;
1350 if ((yyn
= yygindex
[yym
]) && (yyn
+= yystate
) >= 0 &&
1351 yyn
<= YYTABLESIZE
&& yycheck
[yyn
] == yystate
)
1352 yystate
= yytable
[yyn
];
1354 yystate
= yydgoto
[yym
];
1357 printf("%sdebug: after reduction, shifting from state %d \
1358 to state %d\n", YYPREFIX
, *yyssp
, yystate
);
1360 if (yyssp
>= yyss
+ yystacksize
- 1)
1368 yyerror("yacc stack overflow");