|
|
1.1 root 1:
2: # line 2 "grammar.yacc"
3: /* Copyright (c) 1982 Regents of the University of California */
4:
5: static char sccsid[] = "@(#)grammar.yacc 1.2 1/20/82";
6:
7: /*
8: * yacc grammar for debugger commands
9: */
10:
11: #include "defs.h"
12: #include "command.h"
13: #include "sym.h"
14: #include "symtab.h"
15: #include "tree.h"
16: #include "process.h"
17: #include "source.h"
18:
19:
20: # line 43 "grammar.yacc"
21: typedef union {
22: SYM *y_sym;
23: NODE *y_node;
24: int y_int;
25: OP y_op;
26: long y_long;
27: double y_real;
28: char *y_string;
29: BOOLEAN y_bool;
30: } YYSTYPE;
31: # define ALIAS 257
32: # define ASSIGN 258
33: # define CALL 259
34: # define CHFILE 260
35: # define CONT 261
36: # define DUMP 262
37: # define EDIT 263
38: # define GRIPE 264
39: # define HELP 265
40: # define LIST 266
41: # define NEXT 267
42: # define QUIT 268
43: # define REMAKE 269
44: # define PRINT 270
45: # define RUN 271
46: # define SH 272
47: # define SOURCE 273
48: # define STATUS 274
49: # define STEP 275
50: # define STOP 276
51: # define STOPI 277
52: # define TRACE 278
53: # define TRACEI 279
54: # define DELETE 280
55: # define WHATIS 281
56: # define WHICH 282
57: # define WHERE 283
58: # define XI 284
59: # define XD 285
60: # define AT 286
61: # define IN 287
62: # define IF 288
63: # define FILENAME 289
64: # define INT 290
65: # define REAL 291
66: # define NAME 292
67: # define STRING 293
68: # define DIV 294
69: # define MOD 295
70: # define AND 296
71: # define OR 297
72: # define NOT 298
73: # define UNARYSIGN 299
74: #define yyclearin yychar = -1
75: #define yyerrok yyerrflag = 0
76: extern int yychar;
77: extern short yyerrflag;
78: #ifndef YYMAXDEPTH
79: #define YYMAXDEPTH 150
80: #endif
81: YYSTYPE yylval, yyval;
82: # define YYERRCODE 256
83:
84: # line 530 "grammar.yacc"
85:
86:
87: /*
88: * parser error handling
89: */
90:
91: yyerror(s)
92: char *s;
93: {
94: if (strcmp(s, "syntax error") == 0) {
95: error("bad command syntax");
96: } else {
97: error(s);
98: }
99: }
100:
101: /*
102: * In recovering from an error we gobble input up to a newline.
103: */
104:
105: gobble()
106: {
107: register int t;
108:
109: if (!nlflag) {
110: while ((t = yylex()) != '\n' && t != 0);
111: }
112: }
113: short yyexca[] ={
114: -1, 1,
115: 0, -1,
116: -2, 0,
117: -1, 140,
118: 60, 0,
119: 61, 0,
120: 62, 0,
121: -2, 79,
122: };
123: # define YYNPROD 106
124: # define YYLAST 370
125: short yyact[]={
126:
127: 4, 48, 135, 79, 44, 50, 45, 47, 127, 69,
128: 76, 77, 90, 89, 87, 86, 83, 76, 93, 150,
129: 109, 56, 40, 145, 104, 100, 109, 101, 143, 105,
130: 104, 100, 130, 101, 152, 105, 109, 55, 141, 142,
131: 104, 55, 110, 112, 111, 105, 55, 109, 110, 112,
132: 111, 104, 100, 96, 101, 109, 105, 95, 39, 104,
133: 100, 122, 101, 92, 105, 49, 94, 119, 151, 110,
134: 112, 111, 75, 80, 53, 42, 109, 110, 112, 111,
135: 104, 100, 66, 101, 41, 105, 8, 3, 67, 2,
136: 1, 62, 51, 85, 60, 59, 61, 93, 82, 62,
137: 132, 74, 60, 6, 61, 57, 103, 73, 62, 133,
138: 58, 60, 103, 61, 134, 93, 62, 5, 137, 60,
139: 46, 61, 113, 71, 71, 99, 98, 88, 93, 81,
140: 81, 78, 97, 103, 124, 144, 17, 84, 18, 117,
141: 118, 103, 92, 0, 129, 94, 126, 128, 0, 131,
142: 0, 0, 91, 0, 0, 149, 125, 136, 0, 0,
143: 92, 0, 103, 94, 0, 0, 114, 115, 116, 0,
144: 0, 0, 0, 92, 120, 0, 94, 0, 0, 0,
145: 121, 0, 120, 0, 0, 146, 0, 0, 0, 0,
146: 0, 0, 0, 0, 0, 0, 0, 0, 147, 0,
147: 0, 0, 0, 138, 139, 140, 0, 0, 0, 0,
148: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
149: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
150: 0, 0, 0, 43, 0, 0, 148, 0, 0, 0,
151: 0, 0, 0, 0, 0, 0, 0, 25, 9, 26,
152: 10, 11, 28, 27, 29, 30, 12, 13, 15, 31,
153: 14, 34, 7, 32, 33, 16, 35, 36, 37, 38,
154: 19, 20, 21, 22, 23, 24, 106, 107, 108, 102,
155: 0, 0, 106, 107, 108, 102, 0, 0, 0, 0,
156: 123, 54, 106, 107, 108, 54, 0, 52, 0, 0,
157: 54, 0, 0, 106, 107, 108, 102, 0, 0, 0,
158: 0, 106, 107, 108, 102, 0, 0, 0, 0, 0,
159: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
160: 0, 0, 106, 107, 108, 102, 0, 48, 0, 0,
161: 0, 63, 64, 47, 65, 70, 69, 76, 72, 63,
162: 64, 47, 65, 0, 70, 69, 68, 72, 63, 64,
163: 47, 65, 48, 0, 0, 0, 63, 64, 47, 65 };
164: short yypact[]={
165:
166: -1000, -10,-1000, 48,-1000,-1000, -40,-1000, -56,-285,
167: -284,-1000, 5,-1000, 76,-1000,-1000, 68, 59,-279,
168: -285,-289,-1000, 76, 76,-273,-285,-284,-1000,-1000,
169: -1000,-1000,-274,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
170: -275,-1000, -56,-1000,-276,-277, 51,-1000,-1000,-1000,
171: -1000,-1000,-1000, 13,-1000,-1000,-1000, 9, 82,-1000,
172: 76, 76, 76,-1000,-1000,-1000,-271,-271, 76,-285,
173: 1, 17, 10,-278,-271,-1000, 76,-1000, -28,-1000,
174: -1000, -12,-1000,-284, 69,-1000,-1000,-1000,-1000,-1000,
175: -1000, 17, 76,-290,-1000, 10, 76, 76, 76, 76,
176: -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
177: -23, -33,-1000, 76, -2, -2, -18,-1000,-1000,-1000,
178: 17, -28,-1000, 10,-1000,-271,-1000, 1,-1000,-1000,
179: 76,-1000,-1000, 76, -74,-1000,-1000,-1000, -2,-1000,
180: 38,-1000,-1000,-1000, 27,-1000,-1000,-1000, 17, -7,
181: -1000,-1000,-1000 };
182: short yypgo[]={
183:
184: 0, 138, 136, 132, 126, 125, 65, 117, 103, 88,
185: 82, 100, 72, 21, 105, 67, 110, 95, 92, 61,
186: 73, 90, 89, 87, 86, 84, 75 };
187: short yyr1[]={
188:
189: 0, 21, 21, 22, 22, 23, 23, 23, 23, 23,
190: 24, 25, 25, 26, 26, 26, 7, 7, 7, 7,
191: 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
192: 7, 7, 7, 7, 7, 7, 7, 7, 8, 8,
193: 8, 8, 8, 8, 8, 8, 8, 8, 1, 1,
194: 2, 2, 9, 9, 10, 10, 10, 6, 6, 11,
195: 11, 18, 18, 18, 19, 19, 20, 20, 12, 12,
196: 13, 13, 14, 14, 14, 14, 14, 14, 14, 14,
197: 14, 15, 16, 16, 16, 16, 16, 17, 17, 17,
198: 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
199: 5, 5, 5, 5, 5, 5 };
200: short yyr2[]={
201:
202: 0, 2, 0, 2, 1, 1, 1, 3, 1, 2,
203: 1, 2, 0, 1, 2, 2, 3, 2, 1, 2,
204: 2, 1, 2, 1, 1, 3, 3, 3, 4, 3,
205: 3, 2, 2, 2, 2, 1, 2, 2, 3, 1,
206: 3, 2, 1, 1, 1, 1, 2, 1, 1, 1,
207: 1, 1, 1, 2, 2, 2, 3, 0, 1, 0,
208: 3, 0, 1, 3, 1, 1, 1, 3, 0, 2,
209: 1, 3, 1, 4, 1, 2, 2, 3, 3, 3,
210: 3, 1, 1, 1, 4, 3, 2, 1, 1, 1,
211: 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
212: 1, 2, 1, 2, 1, 2 };
213: short yychk[]={
214:
215: -1000, -21, -22, -23, 10, -7, -8, 272, -24, 258,
216: 260, 261, 266, 267, 270, 268, 275, -2, -1, 280,
217: 281, 282, 283, 284, 285, 257, 259, 263, 262, 264,
218: 265, 269, 273, 274, 271, 276, 277, 278, 279, 10,
219: 62, -25, -26, 289, 60, 62, -16, 292, 286, -6,
220: 289, -18, 292, -19, 290, 36, -13, -14, -16, -17,
221: 43, 45, 40, 290, 291, 293, -10, -9, 288, 287,
222: 286, -14, 289, -9, -10, -12, 288, 290, -16, 292,
223: -20, -14, -20, 289, -16, -6, 289, 289, -25, 289,
224: 289, -14, 91, 46, 94, 44, 44, -3, -4, -5,
225: 43, 45, 297, 124, 42, 47, 294, 295, 296, 38,
226: 60, 62, 61, 40, -14, -14, -14, -12, -12, -15,
227: -14, -16, -19, 289, -19, -10, -12, 286, -12, -15,
228: 44, -6, -11, 40, -13, 292, -19, -13, -14, -14,
229: -14, 61, 62, 61, -13, 41, -19, -12, -14, -13,
230: 93, 41, 41 };
231: short yydef[]={
232:
233: 2, -2, 1, 0, 4, 5, 6, 8, 12, 0,
234: 57, 18, 61, 21, 0, 23, 24, 0, 68, 0,
235: 0, 0, 35, 0, 0, 39, 0, 57, 42, 43,
236: 44, 45, 0, 47, 10, 50, 51, 48, 49, 3,
237: 0, 9, 12, 13, 0, 0, 0, 82, 83, 17,
238: 58, 19, 20, 62, 64, 65, 22, 70, 72, 74,
239: 0, 0, 0, 87, 88, 89, 68, 68, 0, 0,
240: 83, 52, 0, 68, 68, 31, 0, 32, 33, 34,
241: 36, 66, 37, 57, 59, 41, 46, 7, 11, 14,
242: 15, 16, 0, 0, 86, 0, 0, 0, 0, 0,
243: 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
244: 100, 102, 104, 0, 75, 76, 0, 25, 26, 27,
245: 81, 54, 55, 0, 53, 68, 30, 0, 29, 69,
246: 0, 38, 40, 0, 0, 85, 63, 71, 77, 78,
247: -2, 101, 105, 103, 0, 80, 56, 28, 67, 0,
248: 84, 73, 60 };
249: #
250: # define YYFLAG -1000
251: # define YYERROR goto yyerrlab
252: # define YYACCEPT return(0)
253: # define YYABORT return(1)
254:
255: /* parser for yacc output */
256:
257: #ifdef YYDEBUG
258: int yydebug = 0; /* 1 for debugging */
259: #endif
260: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
261: int yychar = -1; /* current input token number */
262: int yynerrs = 0; /* number of errors */
263: short yyerrflag = 0; /* error recovery flag */
264:
265: yyparse() {
266:
267: short yys[YYMAXDEPTH];
268: short yyj, yym;
269: register YYSTYPE *yypvt;
270: register short yystate, *yyps, yyn;
271: register YYSTYPE *yypv;
272: register short *yyxi;
273:
274: yystate = 0;
275: yychar = -1;
276: yynerrs = 0;
277: yyerrflag = 0;
278: yyps= &yys[-1];
279: yypv= &yyv[-1];
280:
281: yystack: /* put a state and value onto the stack */
282:
283: #ifdef YYDEBUG
284: if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
285: #endif
286: if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
287: *yyps = yystate;
288: ++yypv;
289: *yypv = yyval;
290:
291: yynewstate:
292:
293: yyn = yypact[yystate];
294:
295: if( yyn<= YYFLAG ) goto yydefault; /* simple state */
296:
297: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
298: if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
299:
300: if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
301: yychar = -1;
302: yyval = yylval;
303: yystate = yyn;
304: if( yyerrflag > 0 ) --yyerrflag;
305: goto yystack;
306: }
307:
308: yydefault:
309: /* default state action */
310:
311: if( (yyn=yydef[yystate]) == -2 ) {
312: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
313: /* look through exception table */
314:
315: for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
316:
317: while( *(yyxi+=2) >= 0 ){
318: if( *yyxi == yychar ) break;
319: }
320: if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
321: }
322:
323: if( yyn == 0 ){ /* error */
324: /* error ... attempt to resume parsing */
325:
326: switch( yyerrflag ){
327:
328: case 0: /* brand new error */
329:
330: yyerror( "syntax error" );
331: yyerrlab:
332: ++yynerrs;
333:
334: case 1:
335: case 2: /* incompletely recovered error ... try again */
336:
337: yyerrflag = 3;
338:
339: /* find a state where "error" is a legal shift action */
340:
341: while ( yyps >= yys ) {
342: yyn = yypact[*yyps] + YYERRCODE;
343: if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
344: yystate = yyact[yyn]; /* simulate a shift of "error" */
345: goto yystack;
346: }
347: yyn = yypact[*yyps];
348:
349: /* the current yyps has no shift onn "error", pop stack */
350:
351: #ifdef YYDEBUG
352: if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
353: #endif
354: --yyps;
355: --yypv;
356: }
357:
358: /* there is no state on the stack with an error shift ... abort */
359:
360: yyabort:
361: return(1);
362:
363:
364: case 3: /* no shift yet; clobber input char */
365:
366: #ifdef YYDEBUG
367: if( yydebug ) printf( "error recovery discards char %d\n", yychar );
368: #endif
369:
370: if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
371: yychar = -1;
372: goto yynewstate; /* try again in the same state */
373:
374: }
375:
376: }
377:
378: /* reduction by production yyn */
379:
380: #ifdef YYDEBUG
381: if( yydebug ) printf("reduce %d\n",yyn);
382: #endif
383: yyps -= yyr2[yyn];
384: yypvt = yypv;
385: yypv -= yyr2[yyn];
386: yyval = yypv[1];
387: yym=yyn;
388: /* consult goto table to find next state */
389: yyn = yyr1[yyn];
390: yyj = yypgo[yyn] + *yyps + 1;
391: if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
392: switch(yym){
393:
394: case 1:
395: # line 66 "grammar.yacc"
396: {
397: prompt();
398: } break;
399: case 5:
400: # line 83 "grammar.yacc"
401: {
402: eval(yypvt[-0].y_node);
403: } break;
404: case 6:
405: # line 87 "grammar.yacc"
406: {
407: eval(yypvt[-0].y_node);
408: } break;
409: case 7:
410: # line 91 "grammar.yacc"
411: {
412: setout(yypvt[-0].y_string);
413: eval(yypvt[-2].y_node);
414: unsetout();
415: } break;
416: case 8:
417: # line 97 "grammar.yacc"
418: {
419: shell(yypvt[-0].y_string);
420: } break;
421: case 9:
422: # line 101 "grammar.yacc"
423: {
424: run();
425: } break;
426: case 10:
427: # line 107 "grammar.yacc"
428: {
429: arginit();
430: } break;
431: case 13:
432: # line 117 "grammar.yacc"
433: {
434: newarg(yypvt[-0].y_string);
435: } break;
436: case 14:
437: # line 121 "grammar.yacc"
438: {
439: inarg(yypvt[-0].y_string);
440: } break;
441: case 15:
442: # line 125 "grammar.yacc"
443: {
444: outarg(yypvt[-0].y_string);
445: } break;
446: case 16:
447: # line 131 "grammar.yacc"
448: {
449: yyval.y_node = build(O_ASSIGN, yypvt[-1].y_node, yypvt[-0].y_node);
450: } break;
451: case 17:
452: # line 135 "grammar.yacc"
453: {
454: yyval.y_node = build(O_CHFILE, yypvt[-0].y_string);
455: } break;
456: case 18:
457: # line 139 "grammar.yacc"
458: {
459: yyval.y_node = build(O_CONT);
460: } break;
461: case 19:
462: # line 143 "grammar.yacc"
463: {
464: yyval.y_node = build(O_LIST, yypvt[-0].y_node);
465: } break;
466: case 20:
467: # line 147 "grammar.yacc"
468: {
469: yyval.y_node = build(O_LIST, build(O_NAME, yypvt[-0].y_sym));
470: } break;
471: case 21:
472: # line 151 "grammar.yacc"
473: {
474: yyval.y_node = build(O_NEXT);
475: } break;
476: case 22:
477: # line 155 "grammar.yacc"
478: {
479: yyval.y_node = build(O_PRINT, yypvt[-0].y_node);
480: } break;
481: case 23:
482: # line 159 "grammar.yacc"
483: {
484: quit(0);
485: } break;
486: case 24:
487: # line 163 "grammar.yacc"
488: {
489: yyval.y_node = build(O_STEP);
490: } break;
491: case 25:
492: # line 167 "grammar.yacc"
493: {
494: yyval.y_node = build(yypvt[-2].y_int, NIL, yypvt[-1].y_node, yypvt[-0].y_node);
495: } break;
496: case 26:
497: # line 171 "grammar.yacc"
498: {
499: yyval.y_node = build(yypvt[-2].y_int, yypvt[-1].y_node, NIL, yypvt[-0].y_node);
500: } break;
501: case 27:
502: # line 175 "grammar.yacc"
503: {
504: yyval.y_node = build(yypvt[-2].y_int, NIL, NIL, yypvt[-0].y_node);
505: } break;
506: case 28:
507: # line 179 "grammar.yacc"
508: {
509: yyval.y_node = build(yypvt[-3].y_int, yypvt[-2].y_node, yypvt[-1].y_node, yypvt[-0].y_node);
510: } break;
511: case 29:
512: # line 183 "grammar.yacc"
513: {
514: yyval.y_node = build(yypvt[-2].y_int, NIL, yypvt[-1].y_node, yypvt[-0].y_node);
515: } break;
516: case 30:
517: # line 187 "grammar.yacc"
518: {
519: yyval.y_node = build(yypvt[-2].y_int, yypvt[-1].y_node, NIL, yypvt[-0].y_node);
520: } break;
521: case 31:
522: # line 191 "grammar.yacc"
523: {
524: yyval.y_node = build(yypvt[-1].y_int, NIL, NIL, yypvt[-0].y_node);
525: } break;
526: case 32:
527: # line 195 "grammar.yacc"
528: {
529: yyval.y_node = build(O_DELETE, yypvt[-0].y_long);
530: } break;
531: case 33:
532: # line 199 "grammar.yacc"
533: {
534: yyval.y_node = build(O_WHATIS, yypvt[-0].y_node);
535: } break;
536: case 34:
537: # line 203 "grammar.yacc"
538: {
539: yyval.y_node = build(O_WHICH, yypvt[-0].y_sym);
540: } break;
541: case 35:
542: # line 207 "grammar.yacc"
543: {
544: yyval.y_node = build(O_WHERE);
545: } break;
546: case 36:
547: # line 211 "grammar.yacc"
548: {
549: yyval.y_node = build(O_XI, yypvt[-0].y_node);
550: } break;
551: case 37:
552: # line 215 "grammar.yacc"
553: {
554: yyval.y_node = build(O_XD, yypvt[-0].y_node);
555: } break;
556: case 38:
557: # line 221 "grammar.yacc"
558: {
559: yyval.y_node = build(O_ALIAS, yypvt[-1].y_string, yypvt[-0].y_string);
560: } break;
561: case 39:
562: # line 225 "grammar.yacc"
563: {
564: yyval.y_node = build(O_ALIAS, NIL, NIL);
565: } break;
566: case 40:
567: # line 229 "grammar.yacc"
568: {
569: yyval.y_node = build(O_CALL, yypvt[-1].y_node, yypvt[-0].y_node);
570: } break;
571: case 41:
572: # line 233 "grammar.yacc"
573: {
574: yyval.y_node = build(O_EDIT, yypvt[-0].y_string);
575: } break;
576: case 42:
577: # line 237 "grammar.yacc"
578: {
579: yyval.y_node = build(O_DUMP);
580: } break;
581: case 43:
582: # line 241 "grammar.yacc"
583: {
584: yyval.y_node = build(O_GRIPE);
585: } break;
586: case 44:
587: # line 245 "grammar.yacc"
588: {
589: yyval.y_node = build(O_HELP);
590: } break;
591: case 45:
592: # line 249 "grammar.yacc"
593: {
594: yyval.y_node = build(O_REMAKE);
595: } break;
596: case 46:
597: # line 253 "grammar.yacc"
598: {
599: yyval.y_node = build(O_SOURCE, yypvt[-0].y_string);
600: } break;
601: case 47:
602: # line 257 "grammar.yacc"
603: {
604: yyval.y_node = build(O_STATUS);
605: } break;
606: case 48:
607: # line 263 "grammar.yacc"
608: {
609: yyval.y_int = O_TRACE;
610: } break;
611: case 49:
612: # line 267 "grammar.yacc"
613: {
614: yyval.y_int = O_TRACEI;
615: } break;
616: case 50:
617: # line 273 "grammar.yacc"
618: {
619: yyval.y_int = O_STOP;
620: } break;
621: case 51:
622: # line 277 "grammar.yacc"
623: {
624: yyval.y_int = O_STOPI;
625: } break;
626: case 53:
627: # line 284 "grammar.yacc"
628: {
629: yyval.y_node = build(O_QLINE, yypvt[-1].y_string, yypvt[-0].y_node);
630: } break;
631: case 54:
632: # line 290 "grammar.yacc"
633: {
634: yyval.y_node = yypvt[-0].y_node;
635: } break;
636: case 55:
637: # line 294 "grammar.yacc"
638: {
639: yyval.y_node = build(O_QLINE, cursource, yypvt[-0].y_node);
640: } break;
641: case 56:
642: # line 298 "grammar.yacc"
643: {
644: yyval.y_node = build(O_QLINE, yypvt[-1].y_string, yypvt[-0].y_node);
645: } break;
646: case 57:
647: # line 304 "grammar.yacc"
648: {
649: yyval.y_string = NIL;
650: } break;
651: case 59:
652: # line 311 "grammar.yacc"
653: {
654: yyval.y_node = NIL;
655: } break;
656: case 60:
657: # line 315 "grammar.yacc"
658: {
659: yyval.y_node = yypvt[-1].y_node;
660: } break;
661: case 61:
662: # line 321 "grammar.yacc"
663: {
664: NODE *first, *last;
665:
666: first = build(O_LCON, (long) 1);
667: last = build(O_LCON, (long) lastlinenum);
668: yyval.y_node = build(O_COMMA, first, last);
669: } break;
670: case 62:
671: # line 329 "grammar.yacc"
672: {
673: yyval.y_node = build(O_COMMA, yypvt[-0].y_node, yypvt[-0].y_node);
674: } break;
675: case 63:
676: # line 333 "grammar.yacc"
677: {
678: yyval.y_node = build(O_COMMA, yypvt[-2].y_node, yypvt[-0].y_node);
679: } break;
680: case 64:
681: # line 339 "grammar.yacc"
682: {
683: yyval.y_node = build(O_LCON, yypvt[-0].y_long);
684: } break;
685: case 65:
686: # line 343 "grammar.yacc"
687: {
688: yyval.y_node = build(O_LCON, (long) lastlinenum);
689: } break;
690: case 66:
691: # line 349 "grammar.yacc"
692: {
693: yyval.y_node = build(O_COMMA, yypvt[-0].y_node, yypvt[-0].y_node);
694: } break;
695: case 67:
696: # line 353 "grammar.yacc"
697: {
698: yyval.y_node = build(O_COMMA, yypvt[-2].y_node, yypvt[-0].y_node);
699: } break;
700: case 68:
701: # line 359 "grammar.yacc"
702: {
703: yyval.y_node = NIL;
704: } break;
705: case 69:
706: # line 363 "grammar.yacc"
707: {
708: yyval.y_node = yypvt[-0].y_node;
709: } break;
710: case 70:
711: # line 369 "grammar.yacc"
712: {
713: yyval.y_node = build(O_COMMA, yypvt[-0].y_node, NIL);
714: } break;
715: case 71:
716: # line 373 "grammar.yacc"
717: {
718: yyval.y_node = build(O_COMMA, yypvt[-2].y_node, yypvt[-0].y_node);
719: } break;
720: case 72:
721: # line 379 "grammar.yacc"
722: {
723: yyval.y_node = build(O_RVAL, yypvt[-0].y_node);
724: } break;
725: case 73:
726: # line 383 "grammar.yacc"
727: {
728: yyval.y_node = build(O_CALL, yypvt[-3].y_node, yypvt[-1].y_node);
729: } break;
730: case 75:
731: # line 388 "grammar.yacc"
732: {
733: yyval.y_node = yypvt[-0].y_node;
734: } break;
735: case 76:
736: # line 392 "grammar.yacc"
737: {
738: yyval.y_node = build(O_NEG, yypvt[-0].y_node);
739: } break;
740: case 77:
741: # line 396 "grammar.yacc"
742: {
743: yyval.y_node = build(yypvt[-1].y_op, yypvt[-2].y_node, yypvt[-0].y_node);
744: } break;
745: case 78:
746: # line 400 "grammar.yacc"
747: {
748: yyval.y_node = build(yypvt[-1].y_op, yypvt[-2].y_node, yypvt[-0].y_node);
749: } break;
750: case 79:
751: # line 404 "grammar.yacc"
752: {
753: yyval.y_node = build(yypvt[-1].y_op, yypvt[-2].y_node, yypvt[-0].y_node);
754: } break;
755: case 80:
756: # line 408 "grammar.yacc"
757: {
758: yyval.y_node = yypvt[-1].y_node;
759: } break;
760: case 81:
761: # line 414 "grammar.yacc"
762: {
763: chkboolean(yyval.y_node = yypvt[-0].y_node);
764: } break;
765: case 82:
766: # line 420 "grammar.yacc"
767: {
768: yyval.y_node = build(O_NAME, yypvt[-0].y_sym);
769: } break;
770: case 83:
771: # line 424 "grammar.yacc"
772: {
773: SYM *s;
774:
775: s = st_lookup(symtab, "at");
776: if (s == NIL) {
777: error("\"at\" is not defined");
778: }
779: yyval.y_node = build(O_NAME, s);
780: } break;
781: case 84:
782: # line 434 "grammar.yacc"
783: {
784: yyval.y_node = subscript(yypvt[-3].y_node, yypvt[-1].y_node);
785: } break;
786: case 85:
787: # line 438 "grammar.yacc"
788: {
789: yyval.y_node = dot(yypvt[-2].y_node, yypvt[-0].y_sym);
790: } break;
791: case 86:
792: # line 442 "grammar.yacc"
793: {
794: yyval.y_node = build(O_INDIR, yypvt[-1].y_node);
795: } break;
796: case 87:
797: # line 448 "grammar.yacc"
798: {
799: yyval.y_node = build(O_LCON, yypvt[-0].y_long);
800: } break;
801: case 88:
802: # line 452 "grammar.yacc"
803: {
804: yyval.y_node = build(O_FCON, yypvt[-0].y_real);
805: } break;
806: case 89:
807: # line 456 "grammar.yacc"
808: {
809: yyval.y_node = build(O_SCON, yypvt[-0].y_string);
810: } break;
811: case 90:
812: # line 462 "grammar.yacc"
813: {
814: yyval.y_op = O_ADD;
815: } break;
816: case 91:
817: # line 466 "grammar.yacc"
818: {
819: yyval.y_op = O_SUB;
820: } break;
821: case 92:
822: # line 470 "grammar.yacc"
823: {
824: yyval.y_op = O_OR;
825: } break;
826: case 93:
827: # line 474 "grammar.yacc"
828: {
829: yyval.y_op = O_OR;
830: } break;
831: case 94:
832: # line 480 "grammar.yacc"
833: {
834: yyval.y_op = O_MUL;
835: } break;
836: case 95:
837: # line 484 "grammar.yacc"
838: {
839: yyval.y_op = O_DIVF;
840: } break;
841: case 96:
842: # line 488 "grammar.yacc"
843: {
844: yyval.y_op = O_DIV;
845: } break;
846: case 97:
847: # line 492 "grammar.yacc"
848: {
849: yyval.y_op = O_MOD;
850: } break;
851: case 98:
852: # line 496 "grammar.yacc"
853: {
854: yyval.y_op = O_AND;
855: } break;
856: case 99:
857: # line 500 "grammar.yacc"
858: {
859: yyval.y_op = O_AND;
860: } break;
861: case 100:
862: # line 506 "grammar.yacc"
863: {
864: yyval.y_op = O_LT;
865: } break;
866: case 101:
867: # line 510 "grammar.yacc"
868: {
869: yyval.y_op = O_LE;
870: } break;
871: case 102:
872: # line 514 "grammar.yacc"
873: {
874: yyval.y_op = O_GT;
875: } break;
876: case 103:
877: # line 518 "grammar.yacc"
878: {
879: yyval.y_op = O_GE;
880: } break;
881: case 104:
882: # line 522 "grammar.yacc"
883: {
884: yyval.y_op = O_EQ;
885: } break;
886: case 105:
887: # line 526 "grammar.yacc"
888: {
889: yyval.y_op = O_NE;
890: } break;
891: }
892: goto yystack; /* stack new state and value */
893:
894: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.