|
|
1.1 root 1: # define number 257
2: # define stop 258
3: # define DEFINED 259
4: # define EQ 260
5: # define NE 261
6: # define LE 262
7: # define GE 263
8: # define LS 264
9: # define RS 265
10: # define ANDAND 266
11: # define OROR 267
12: # define UMINUS 268
13: #define yyclearin yychar = -1
14: #define yyerrok yyerrflag = 0
15: extern int yychar;
16: extern short yyerrflag;
17: #ifndef YYMAXDEPTH
18: #define YYMAXDEPTH 150
19: #endif
20: #ifndef YYSTYPE
21: #define YYSTYPE int
22: #endif
23: YYSTYPE yylval, yyval;
24: # define YYERRCODE 256
25:
26: # line 82 "cpy.y"
27:
28: # include "yylex.c"
29: extern short yyexca[];
30: # define YYNPROD 30
31: # define YYLAST 363
32: extern short yyact[];
33: extern short yypact[];
34: extern short yypgo[];
35: extern short yyr1[];
36: extern short yyr2[];
37: extern short yychk[];
38: extern short yydef[];
39: #ifndef lint
40: static char yaccpar_sccsid[] = "@(#)yaccpar 4.1 (Berkeley) 2/11/83";
41: #endif not lint
42:
43: #
44: # define YYFLAG -1000
45: # define YYERROR goto yyerrlab
46: # define YYACCEPT return(0)
47: # define YYABORT return(1)
48:
49: /* parser for yacc output */
50:
51: #ifdef YYDEBUG
52: int yydebug = 0; /* 1 for debugging */
53: #endif
54: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
55: int yychar = -1; /* current input token number */
56: int yynerrs = 0; /* number of errors */
57: short yyerrflag = 0; /* error recovery flag */
58:
59: yyparse() {
60:
61: short yys[YYMAXDEPTH];
62: short yyj, yym;
63: register YYSTYPE *yypvt;
64: register short yystate, *yyps, yyn;
65: register YYSTYPE *yypv;
66: register short *yyxi;
67:
68: yystate = 0;
69: yychar = -1;
70: yynerrs = 0;
71: yyerrflag = 0;
72: yyps= &yys[-1];
73: yypv= &yyv[-1];
74:
75: yystack: /* put a state and value onto the stack */
76:
77: #ifdef YYDEBUG
78: if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
79: #endif
80: if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
81: *yyps = yystate;
82: ++yypv;
83: *yypv = yyval;
84:
85: yynewstate:
86:
87: yyn = yypact[yystate];
88:
89: if( yyn<= YYFLAG ) goto yydefault; /* simple state */
90:
91: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
92: if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
93:
94: if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
95: yychar = -1;
96: yyval = yylval;
97: yystate = yyn;
98: if( yyerrflag > 0 ) --yyerrflag;
99: goto yystack;
100: }
101:
102: yydefault:
103: /* default state action */
104:
105: if( (yyn=yydef[yystate]) == -2 ) {
106: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
107: /* look through exception table */
108:
109: for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
110:
111: while( *(yyxi+=2) >= 0 ){
112: if( *yyxi == yychar ) break;
113: }
114: if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
115: }
116:
117: if( yyn == 0 ){ /* error */
118: /* error ... attempt to resume parsing */
119:
120: switch( yyerrflag ){
121:
122: case 0: /* brand new error */
123:
124: yyerror( "syntax error" );
125: yyerrlab:
126: ++yynerrs;
127:
128: case 1:
129: case 2: /* incompletely recovered error ... try again */
130:
131: yyerrflag = 3;
132:
133: /* find a state where "error" is a legal shift action */
134:
135: while ( yyps >= yys ) {
136: yyn = yypact[*yyps] + YYERRCODE;
137: if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
138: yystate = yyact[yyn]; /* simulate a shift of "error" */
139: goto yystack;
140: }
141: yyn = yypact[*yyps];
142:
143: /* the current yyps has no shift onn "error", pop stack */
144:
145: #ifdef YYDEBUG
146: if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
147: #endif
148: --yyps;
149: --yypv;
150: }
151:
152: /* there is no state on the stack with an error shift ... abort */
153:
154: yyabort:
155: return(1);
156:
157:
158: case 3: /* no shift yet; clobber input char */
159:
160: #ifdef YYDEBUG
161: if( yydebug ) printf( "error recovery discards char %d\n", yychar );
162: #endif
163:
164: if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
165: yychar = -1;
166: goto yynewstate; /* try again in the same state */
167:
168: }
169:
170: }
171:
172: /* reduction by production yyn */
173:
174: #ifdef YYDEBUG
175: if( yydebug ) printf("reduce %d\n",yyn);
176: #endif
177: yyps -= yyr2[yyn];
178: yypvt = yypv;
179: yypv -= yyr2[yyn];
180: yyval = yypv[1];
181: yym=yyn;
182: /* consult goto table to find next state */
183: yyn = yyr1[yyn];
184: yyj = yypgo[yyn] + *yyps + 1;
185: if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
186: switch(yym){
187:
188: case 1:
189: # line 22 "cpy.y"
190: {return(yypvt[-1]);} break;
191: case 2:
192: # line 26 "cpy.y"
193: {yyval = yypvt[-2] * yypvt[-0];} break;
194: case 3:
195: # line 28 "cpy.y"
196: {yyval = yypvt[-2] / yypvt[-0];} break;
197: case 4:
198: # line 30 "cpy.y"
199: {yyval = yypvt[-2] % yypvt[-0];} break;
200: case 5:
201: # line 32 "cpy.y"
202: {yyval = yypvt[-2] + yypvt[-0];} break;
203: case 6:
204: # line 34 "cpy.y"
205: {yyval = yypvt[-2] - yypvt[-0];} break;
206: case 7:
207: # line 36 "cpy.y"
208: {yyval = yypvt[-2] << yypvt[-0];} break;
209: case 8:
210: # line 38 "cpy.y"
211: {yyval = yypvt[-2] >> yypvt[-0];} break;
212: case 9:
213: # line 40 "cpy.y"
214: {yyval = yypvt[-2] < yypvt[-0];} break;
215: case 10:
216: # line 42 "cpy.y"
217: {yyval = yypvt[-2] > yypvt[-0];} break;
218: case 11:
219: # line 44 "cpy.y"
220: {yyval = yypvt[-2] <= yypvt[-0];} break;
221: case 12:
222: # line 46 "cpy.y"
223: {yyval = yypvt[-2] >= yypvt[-0];} break;
224: case 13:
225: # line 48 "cpy.y"
226: {yyval = yypvt[-2] == yypvt[-0];} break;
227: case 14:
228: # line 50 "cpy.y"
229: {yyval = yypvt[-2] != yypvt[-0];} break;
230: case 15:
231: # line 52 "cpy.y"
232: {yyval = yypvt[-2] & yypvt[-0];} break;
233: case 16:
234: # line 54 "cpy.y"
235: {yyval = yypvt[-2] ^ yypvt[-0];} break;
236: case 17:
237: # line 56 "cpy.y"
238: {yyval = yypvt[-2] | yypvt[-0];} break;
239: case 18:
240: # line 58 "cpy.y"
241: {yyval = yypvt[-2] && yypvt[-0];} break;
242: case 19:
243: # line 60 "cpy.y"
244: {yyval = yypvt[-2] || yypvt[-0];} break;
245: case 20:
246: # line 62 "cpy.y"
247: {yyval = yypvt[-4] ? yypvt[-2] : yypvt[-0];} break;
248: case 21:
249: # line 64 "cpy.y"
250: {yyval = yypvt[-0];} break;
251: case 22:
252: # line 66 "cpy.y"
253: {yyval = yypvt[-0];} break;
254: case 23:
255: # line 69 "cpy.y"
256: {yyval = -yypvt[-0];} break;
257: case 24:
258: # line 71 "cpy.y"
259: {yyval = !yypvt[-0];} break;
260: case 25:
261: # line 73 "cpy.y"
262: {yyval = ~yypvt[-0];} break;
263: case 26:
264: # line 75 "cpy.y"
265: {yyval = yypvt[-1];} break;
266: case 27:
267: # line 77 "cpy.y"
268: {yyval= yypvt[-1];} break;
269: case 28:
270: # line 79 "cpy.y"
271: {yyval = yypvt[-0];} break;
272: case 29:
273: # line 81 "cpy.y"
274: {yyval= yypvt[-0];} break;
275: }
276: goto yystack; /* stack new state and value */
277:
278: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.