1: # define NAME 2 2: # define STRING 3 3: # define ICON 4 4: # define FCON 5 5: # define PLUS 6 6: # define MINUS 8 7: # define MUL 11 8: # define AND 14 9: # define OR 17 10: # define ER 19 11: # define QUEST 21 12: # define COLON 22 13: # define ANDAND 23 14: # define OROR 24 15: # define ASOP 25 16: # define RELOP 26 17: # define EQUOP 27 18: # define DIVOP 28 19: # define SHIFTOP 29 20: # define INCOP 30 21: # define UNOP 31 22: # define STROP 32 23: # define TYPE 33 24: # define CLASS 34 25: # define STRUCT 35 26: # define RETURN 36 27: # define GOTO 37 28: # define IF 38 29: # define ELSE 39 30: # define SWITCH 40 31: # define BREAK 41 32: # define CONTINUE 42 33: # define WHILE 43 34: # define DO 44 35: # define FOR 45 36: # define DEFAULT 46 37: # define CASE 47 38: # define SIZEOF 48 39: # define ENUM 49 40: # define LP 50 41: # define RP 51 42: # define LC 52 43: # define RC 53 44: # define LB 54 45: # define RB 55 46: # define CM 56 47: # define SM 57 48: # define ASSIGN 58 49: 50: # line 108 "../mip/cgram.y" 51: # include "mfile1" 52: #define yyclearin yychar = -1 53: #define yyerrok yyerrflag = 0 54: extern int yychar; 55: extern short yyerrflag; 56: #ifndef YYMAXDEPTH 57: #define YYMAXDEPTH 150 58: #endif 59: YYSTYPE yylval, yyval; 60: 61: # line 127 "../mip/cgram.y" 62: static int fake = 0; 63: static char fakename[NCHNAM+1]; 64: # define YYERRCODE 256 65: 66: # line 779 "../mip/cgram.y" 67: 68: 69: NODE * 70: mkty( t, d, s ) unsigned t; { 71: return( block( TYPE, NIL, NIL, t, d, s ) ); 72: } 73: 74: NODE * 75: bdty( op, p, v ) NODE *p; { 76: register NODE *q; 77: 78: q = block( op, p, NIL, INT, 0, INT ); 79: 80: switch( op ){ 81: 82: case UNARY MUL: 83: case UNARY CALL: 84: break; 85: 86: case LB: 87: q->right = bcon(v); 88: break; 89: 90: case NAME: 91: q->rval = v; 92: break; 93: 94: default: 95: cerror( "bad bdty" ); 96: } 97: 98: return( q ); 99: } 100: 101: dstash( n ){ /* put n into the dimension table */ 102: if( curdim >= DIMTABSZ-1 ){ 103: cerror( "dimension table overflow"); 104: } 105: dimtab[ curdim++ ] = n; 106: } 107: 108: savebc() { 109: if( psavbc > & asavbc[BCSZ-4 ] ){ 110: cerror( "whiles, fors, etc. too deeply nested"); 111: } 112: *psavbc++ = brklab; 113: *psavbc++ = contlab; 114: *psavbc++ = flostat; 115: *psavbc++ = swx; 116: flostat = 0; 117: } 118: 119: resetbc(mask){ 120: 121: swx = *--psavbc; 122: flostat = *--psavbc | (flostat&mask); 123: contlab = *--psavbc; 124: brklab = *--psavbc; 125: 126: } 127: 128: addcase(p) NODE *p; { /* add case to switch */ 129: 130: p = optim( p ); /* change enum to ints */ 131: if( p->op != ICON ){ 132: uerror( "non-constant case expression"); 133: return; 134: } 135: if( swp == swtab ){ 136: uerror( "case not in switch"); 137: return; 138: } 139: if( swp >= &swtab[SWITSZ] ){ 140: cerror( "switch table overflow"); 141: } 142: swp->sval = p->lval; 143: deflab( swp->slab = getlab() ); 144: ++swp; 145: tfree(p); 146: } 147: 148: adddef(){ /* add default case to switch */ 149: if( swtab[swx].slab >= 0 ){ 150: uerror( "duplicate default in switch"); 151: return; 152: } 153: if( swp == swtab ){ 154: uerror( "default not inside switch"); 155: return; 156: } 157: deflab( swtab[swx].slab = getlab() ); 158: } 159: 160: swstart(){ 161: /* begin a switch block */ 162: if( swp >= &swtab[SWITSZ] ){ 163: cerror( "switch table overflow"); 164: } 165: swx = swp - swtab; 166: swp->slab = -1; 167: ++swp; 168: } 169: 170: swend(){ /* end a switch block */ 171: 172: register struct sw *swbeg, *p, *q, *r, *r1; 173: CONSZ temp; 174: int tempi; 175: 176: swbeg = &swtab[swx+1]; 177: 178: /* sort */ 179: 180: r1 = swbeg; 181: r = swp-1; 182: 183: while( swbeg < r ){ 184: /* bubble largest to end */ 185: for( q=swbeg; q<r; ++q ){ 186: if( q->sval > (q+1)->sval ){ 187: /* swap */ 188: r1 = q+1; 189: temp = q->sval; 190: q->sval = r1->sval; 191: r1->sval = temp; 192: tempi = q->slab; 193: q->slab = r1->slab; 194: r1->slab = tempi; 195: } 196: } 197: r = r1; 198: r1 = swbeg; 199: } 200: 201: /* it is now sorted */ 202: 203: for( p = swbeg+1; p<swp; ++p ){ 204: if( p->sval == (p-1)->sval ){ 205: uerror( "duplicate case in switch, %d", tempi=p->sval ); 206: return; 207: } 208: } 209: 210: genswitch( swbeg-1, swp-swbeg ); 211: swp = swbeg-1; 212: } 213: short yyexca[] ={ 214: -1, 1, 215: 0, -1, 216: 2, 21, 217: 11, 21, 218: 50, 21, 219: 57, 21, 220: -2, 0, 221: -1, 19, 222: 56, 78, 223: 57, 78, 224: -2, 7, 225: -1, 24, 226: 56, 77, 227: 57, 77, 228: -2, 75, 229: -1, 32, 230: 52, 43, 231: -2, 41, 232: -1, 34, 233: 52, 35, 234: -2, 33, 235: }; 236: # define YYNPROD 179 237: # define YYLAST 1170 238: short yyact[]={ 239: 240: 229, 24, 263, 249, 87, 85, 86, 26, 26, 78, 241: 227, 128, 76, 26, 75, 77, 21, 21, 10, 9, 242: 14, 96, 21, 40, 42, 127, 26, 94, 94, 98, 243: 91, 80, 79, 18, 16, 21, 90, 239, 240, 244, 244: 64, 248, 237, 238, 245, 246, 247, 251, 250, 81, 245: 73, 82, 194, 106, 228, 22, 22, 93, 241, 143, 246: 26, 22, 160, 10, 9, 14, 108, 57, 225, 21, 247: 230, 54, 272, 20, 22, 129, 271, 8, 50, 16, 248: 92, 17, 106, 144, 148, 28, 19, 36, 257, 72, 249: 304, 136, 137, 138, 139, 140, 141, 6, 152, 203, 250: 36, 35, 41, 43, 303, 298, 93, 287, 22, 55, 251: 267, 266, 162, 163, 164, 166, 168, 170, 172, 174, 252: 175, 177, 179, 181, 182, 183, 184, 185, 132, 161, 253: 134, 129, 101, 99, 189, 154, 89, 198, 187, 157, 254: 100, 159, 197, 144, 152, 68, 97, 281, 135, 186, 255: 69, 254, 133, 38, 67, 256, 188, 39, 219, 104, 256: 145, 151, 110, 107, 71, 156, 204, 55, 205, 38, 257: 206, 47, 207, 39, 208, 48, 153, 209, 63, 210, 258: 219, 211, 253, 249, 87, 85, 86, 213, 129, 78, 259: 155, 150, 76, 33, 200, 77, 47, 66, 223, 214, 260: 48, 93, 191, 46, 47, 26, 293, 218, 48, 31, 261: 215, 80, 79, 252, 21, 285, 196, 239, 240, 244, 262: 145, 248, 237, 238, 245, 246, 247, 251, 250, 81, 263: 224, 82, 218, 106, 196, 226, 264, 278, 241, 217, 264: 269, 4, 259, 260, 261, 262, 192, 265, 221, 222, 265: 70, 279, 45, 22, 273, 195, 201, 242, 62, 294, 266: 255, 95, 95, 282, 277, 149, 276, 27, 10, 9, 267: 14, 275, 274, 195, 220, 288, 289, 264, 291, 290, 268: 27, 149, 100, 51, 16, 284, 105, 283, 9, 114, 269: 52, 115, 30, 280, 117, 300, 295, 119, 270, 264, 270: 120, 301, 121, 10, 124, 14, 122, 123, 125, 111, 271: 118, 113, 116, 114, 27, 115, 190, 7, 117, 16, 272: 117, 65, 58, 109, 34, 114, 29, 115, 32, 243, 273: 117, 103, 130, 119, 302, 113, 120, 113, 121, 112, 274: 124, 126, 122, 123, 125, 111, 118, 113, 116, 49, 275: 25, 59, 44, 199, 88, 53, 56, 158, 202, 102, 276: 61, 114, 60, 115, 37, 3, 117, 2, 147, 119, 277: 299, 83, 120, 11, 121, 112, 124, 126, 122, 123, 278: 125, 111, 118, 113, 116, 12, 5, 23, 13, 15, 279: 236, 234, 235, 233, 231, 232, 1, 114, 0, 115, 280: 0, 0, 117, 0, 0, 119, 297, 0, 120, 0, 281: 121, 112, 124, 126, 122, 123, 125, 111, 118, 113, 282: 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 283: 114, 0, 115, 0, 0, 117, 0, 242, 0, 0, 284: 0, 0, 296, 114, 0, 115, 0, 112, 117, 126, 285: 111, 119, 113, 116, 120, 0, 121, 0, 124, 292, 286: 122, 123, 125, 111, 118, 113, 116, 114, 0, 115, 287: 0, 0, 117, 0, 0, 119, 0, 0, 120, 0, 288: 121, 0, 124, 0, 122, 123, 125, 111, 118, 113, 289: 116, 0, 114, 112, 115, 126, 0, 117, 0, 114, 290: 119, 115, 0, 120, 117, 121, 0, 124, 0, 122, 291: 123, 125, 111, 118, 113, 116, 0, 112, 286, 126, 292: 0, 113, 116, 0, 0, 0, 0, 0, 0, 0, 293: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 294: 0, 0, 112, 258, 126, 114, 0, 115, 0, 0, 295: 117, 0, 0, 119, 0, 0, 120, 0, 121, 0, 296: 124, 0, 122, 123, 125, 111, 118, 113, 116, 114, 297: 0, 115, 0, 0, 117, 0, 0, 119, 0, 0, 298: 120, 0, 121, 0, 124, 212, 122, 123, 125, 111, 299: 118, 113, 116, 0, 216, 112, 0, 126, 0, 0, 300: 0, 0, 0, 0, 0, 114, 0, 115, 0, 114, 301: 117, 115, 0, 119, 117, 0, 120, 119, 121, 112, 302: 124, 126, 122, 123, 125, 111, 118, 113, 116, 111, 303: 118, 113, 116, 0, 0, 0, 0, 0, 0, 0, 304: 0, 114, 0, 115, 0, 0, 117, 0, 0, 119, 305: 193, 0, 120, 0, 121, 112, 124, 126, 122, 123, 306: 125, 111, 118, 113, 116, 114, 0, 115, 0, 0, 307: 117, 0, 0, 119, 0, 0, 120, 0, 121, 0, 308: 124, 0, 122, 123, 125, 111, 118, 113, 116, 0, 309: 0, 112, 0, 126, 84, 87, 85, 86, 0, 0, 310: 78, 0, 0, 76, 0, 0, 77, 84, 87, 85, 311: 86, 0, 0, 78, 0, 0, 76, 126, 0, 77, 312: 0, 0, 80, 79, 0, 0, 0, 0, 0, 0, 313: 0, 0, 0, 0, 0, 80, 79, 0, 0, 0, 314: 81, 0, 82, 0, 0, 84, 87, 85, 86, 0, 315: 180, 78, 0, 81, 76, 82, 0, 77, 84, 87, 316: 85, 86, 0, 178, 78, 0, 0, 76, 0, 0, 317: 77, 0, 0, 80, 79, 0, 0, 0, 0, 0, 318: 0, 0, 0, 0, 0, 0, 80, 79, 0, 0, 319: 0, 81, 0, 82, 0, 0, 84, 87, 85, 86, 320: 0, 176, 78, 0, 81, 76, 82, 0, 77, 84, 321: 87, 85, 86, 0, 173, 78, 0, 0, 76, 0, 322: 0, 77, 0, 0, 80, 79, 0, 0, 0, 0, 323: 0, 0, 0, 0, 0, 0, 0, 80, 79, 0, 324: 0, 0, 81, 0, 82, 0, 0, 84, 87, 85, 325: 86, 0, 171, 78, 0, 81, 76, 82, 0, 77, 326: 84, 87, 85, 86, 0, 169, 78, 0, 0, 76, 327: 0, 0, 77, 0, 0, 80, 79, 0, 0, 0, 328: 0, 0, 0, 0, 0, 0, 0, 0, 80, 79, 329: 0, 0, 0, 81, 0, 82, 0, 0, 84, 87, 330: 85, 86, 0, 167, 78, 0, 81, 76, 82, 0, 331: 77, 84, 87, 85, 86, 0, 165, 78, 0, 0, 332: 76, 0, 0, 77, 0, 0, 80, 79, 114, 0, 333: 115, 0, 0, 117, 0, 0, 119, 0, 0, 80, 334: 79, 121, 0, 0, 81, 0, 82, 0, 111, 118, 335: 113, 116, 0, 268, 0, 0, 0, 81, 0, 82, 336: 0, 131, 84, 87, 85, 86, 0, 0, 78, 0, 337: 0, 76, 0, 0, 77, 84, 87, 85, 86, 0, 338: 0, 78, 0, 0, 76, 0, 0, 77, 0, 0, 339: 80, 79, 0, 10, 0, 14, 0, 0, 0, 0, 340: 0, 0, 0, 80, 79, 0, 0, 0, 81, 16, 341: 82, 0, 0, 0, 0, 84, 87, 85, 86, 0, 342: 0, 81, 0, 82, 0, 74, 84, 87, 85, 86, 343: 0, 0, 78, 0, 0, 76, 0, 0, 77, 84, 344: 87, 85, 86, 80, 79, 78, 0, 0, 76, 0, 345: 0, 77, 0, 0, 80, 79, 0, 0, 0, 0, 346: 0, 81, 0, 82, 0, 0, 0, 80, 79, 0, 347: 0, 114, 81, 115, 82, 146, 117, 84, 87, 85, 348: 86, 0, 0, 78, 0, 81, 76, 82, 0, 77, 349: 0, 111, 118, 113, 116, 0, 114, 0, 115, 0, 350: 0, 117, 0, 0, 119, 80, 79, 120, 0, 121, 351: 0, 124, 0, 122, 123, 0, 111, 118, 113, 116, 352: 0, 0, 114, 81, 115, 142, 0, 117, 0, 0, 353: 119, 0, 0, 120, 0, 121, 0, 0, 0, 122, 354: 0, 0, 111, 118, 113, 116, 114, 0, 115, 0, 355: 0, 117, 0, 0, 119, 0, 0, 120, 0, 121, 356: 0, 0, 0, 0, 0, 0, 111, 118, 113, 116 }; 357: short yypact[]={ 358: 359: -1000, -15,-1000,-1000,-1000, 24,-1000, 270, 254,-1000, 360: 259,-1000,-1000, 157, 326, 141, 322,-1000, 44, 119, 361: -1000, 203, 203, 201, 121, 20, 233,-1000,-1000,-1000, 362: 257, 270,-1000, 320,-1000,-1000,-1000,-1000, 207, 123, 363: 121, 119, 146, 103, 94,-1000,-1000, 199, 109, 973, 364: -1000,-1000,-1000, 79,-1000, 6, 90,-1000, -29, 58, 365: -1000, 30,-1000,-1000, 108,1037,-1000,-1000,-1000, 321, 366: -1000,-1000, 107, 659, 909, 98,1037,1037,1037,1037, 367: 1037,1075, 960,1024, 231,-1000,-1000,-1000, 138, 270, 368: 88,-1000, 119, 154,-1000,-1000, 137, 320,-1000,-1000, 369: 119,-1000,-1000,-1000, 5, 72,-1000,-1000, 659,-1000, 370: -1000,1037,1037, 858, 845, 807, 794, 756,1037, 743, 371: 705, 692,1037,1037,1037,1037,1037, 82,-1000, 659, 372: 909,-1000,-1000,1037, 314,-1000, 98, 98, 98, 98, 373: 98, 98, 960, 195, 599, 205,-1000, 86, 659,-1000, 374: -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000, 235, 42, 375: -1000,-1000, 493, 659,-1000,1037, 309,1037, 309,1037, 376: 307,1037,-1000,1037, 424,1065,1037, 922,1037, 603, 377: 1037,1140,1116, 563, 659, 659, 134, 909, 82, 539, 378: -1000, 188,1037,-1000, 126, 223, 205,1037,-1000, 6, 379: -1000, 11, 1,-1000, 659, 659, 659, 659, 659, 659, 380: 659, 659,1037,-1000,-1000, 129,-1000,1013, 98, 96, 381: -1000, 104, 126, 659,-1000,-1000, 31,-1000,-1000, 486, 382: -1000, 181, 181, 181, 181,1037, 181, 54, 53, 896, 383: 296,-1000, 19, 181, 222, 221,-1000, 216, 214, 215, 384: 1037, 271,1090,-1000,-1000, 92, 213,-1000,-1000, 248, 385: -1000,-1000, 242, 164, 635,-1000,-1000,-1000,-1000, 461, 386: 50,-1000,-1000,-1000,1037,1037,1037,1037,-1000, 437, 387: -1000,-1000, 155,-1000, 209, 181,-1000,-1000, 391, 355, 388: 48, 319,-1000,-1000,1037,-1000,-1000,-1000,1037,-1000, 389: 283, 47, 33,-1000,-1000 }; 390: short yypgo[]={ 391: 392: 0, 396, 40, 395, 394, 393, 392, 391, 390, 389, 393: 388, 387, 0, 2, 14, 97, 386, 77, 385, 373, 394: 59, 52, 371, 30, 80, 1, 368, 367, 365, 33, 395: 364, 362, 360, 70, 359, 358, 10, 357, 36, 317, 396: 356, 21, 67, 355, 354, 71, 353, 352, 73, 351, 397: 350, 349, 25, 11, 332, 331, 329, 321 }; 398: short yyr1[]={ 399: 400: 0, 1, 1, 27, 27, 28, 28, 30, 28, 31, 401: 32, 32, 35, 35, 37, 37, 37, 34, 34, 34, 402: 16, 16, 15, 15, 15, 15, 39, 17, 17, 17, 403: 17, 17, 18, 18, 9, 9, 40, 40, 42, 42, 404: 19, 19, 10, 10, 43, 43, 45, 45, 38, 46, 405: 38, 23, 23, 23, 23, 23, 25, 25, 25, 25, 406: 25, 25, 24, 24, 24, 24, 24, 24, 24, 11, 407: 47, 47, 29, 49, 29, 50, 50, 48, 48, 48, 408: 48, 52, 52, 53, 53, 41, 41, 44, 44, 51, 409: 51, 54, 33, 55, 36, 36, 36, 36, 36, 36, 410: 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 411: 36, 56, 56, 56, 7, 4, 3, 5, 6, 8, 412: 57, 2, 13, 13, 26, 26, 12, 12, 12, 12, 413: 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 414: 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 415: 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 416: 14, 14, 14, 14, 14, 14, 14, 14, 14, 20, 417: 21, 21, 21, 21, 21, 21, 21, 22, 22 }; 418: short yyr2[]={ 419: 420: 0, 2, 0, 1, 1, 2, 3, 0, 4, 2, 421: 2, 0, 2, 0, 3, 4, 0, 3, 2, 2, 422: 1, 0, 2, 2, 1, 1, 1, 1, 2, 3, 423: 1, 1, 5, 2, 1, 2, 1, 3, 1, 3, 424: 5, 2, 1, 2, 1, 3, 2, 1, 1, 0, 425: 4, 1, 1, 3, 2, 1, 2, 3, 3, 4, 426: 1, 3, 2, 3, 3, 4, 3, 3, 2, 2, 427: 1, 3, 1, 0, 4, 1, 1, 1, 1, 3, 428: 6, 1, 3, 1, 4, 0, 1, 0, 1, 0, 429: 1, 1, 4, 1, 2, 1, 2, 2, 2, 7, 430: 4, 2, 2, 2, 2, 3, 3, 1, 2, 2, 431: 2, 2, 3, 2, 1, 4, 3, 4, 6, 4, 432: 0, 2, 1, 0, 1, 3, 3, 3, 3, 3, 433: 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 434: 4, 4, 4, 4, 4, 4, 4, 5, 3, 3, 435: 1, 2, 2, 2, 2, 2, 2, 2, 4, 4, 436: 4, 2, 3, 3, 1, 1, 1, 1, 3, 2, 437: 0, 2, 5, 2, 3, 4, 3, 2, 2 }; 438: short yychk[]={ 439: 440: -1000, -1, -27, -28, 256, -16, -15, -39, -17, 34, 441: 33, -19, -18, -10, 35, -9, 49, 57, -29, -24, 442: -48, 11, 50, -11, -25, -50, 2, 256, -17, -39, 443: 33, 52, 2, 52, 2, 57, 56, -30, 50, 54, 444: -25, -24, -25, -24, -47, 51, 2, 50, 54, -51, 445: 58, 50, 33, -43, -45, -17, -40, -42, 2, -49, 446: -31, -32, 51, 55, -2, -57, 51, 51, 51, 56, 447: 51, 55, -2, -12, 52, -14, 11, 14, 8, 31, 448: 30, 48, 50, -22, 2, 4, 5, 3, -44, 57, 449: -38, -23, -24, -25, 22, 256, -41, 56, 58, -48, 450: -24, -33, -34, -55, -15, 256, 52, 55, -12, 2, 451: 55, 26, 56, 28, 6, 8, 29, 11, 27, 14, 452: 17, 19, 23, 24, 21, 25, 58, -52, -53, -12, 453: -54, 52, 30, 54, 32, 50, -14, -14, -14, -14, 454: -14, -14, 50, -20, -12, -17, 51, -26, -12, 50, 455: 53, -45, 56, 22, -2, 53, -42, -2, -37, -38, 456: 57, 57, -12, -12, -12, 58, -12, 58, -12, 58, 457: -12, 58, -12, 58, -12, -12, 58, -12, 58, -12, 458: 58, -12, -12, -12, -12, -12, -41, 56, -52, -12, 459: 2, -20, 51, 51, -21, 50, 11, 56, 51, -46, 460: -2, -15, -35, 57, -12, -12, -12, -12, -12, -12, 461: -12, -12, 22, 53, -53, -41, 55, 51, -14, 54, 462: 51, -21, -21, -12, -23, 57, -29, -36, 53, -12, 463: -33, -4, -3, -5, -7, -6, -8, 41, 42, 36, 464: 37, 57, 256, -56, 38, 43, 44, 45, 40, 2, 465: 47, 46, -12, 53, 55, -2, 51, 57, 57, -36, 466: -36, -36, -36, -13, -12, -36, 57, 57, 57, -12, 467: 2, 57, 53, -36, 50, 50, 50, 50, 22, -12, 468: 22, 55, 50, 39, 43, 51, 57, 57, -12, -12, 469: -13, -12, 22, 51, 50, -36, 51, 51, 57, 51, 470: -12, -13, 51, 57, 57 }; 471: short yydef[]={ 472: 473: 2, -2, 1, 3, 4, 0, 20, 24, 25, 26, 474: 27, 30, 31, 0, 42, 0, 34, 5, 0, -2, 475: 72, 0, 0, 0, -2, 89, 60, 76, 22, 23, 476: 28, 0, -2, 0, -2, 6, 73, 11, 0, 120, 477: 56, 62, 0, 0, 0, 68, 70, 0, 120, 0, 478: 90, 69, 29, 87, 44, 47, 85, 36, 38, 0, 479: 8, 0, 63, 64, 0, 0, 61, 66, 67, 0, 480: 57, 58, 0, 79, 0, 150, 0, 0, 0, 0, 481: 0, 0, 0, 0, 164, 165, 166, 167, 0, 88, 482: 46, 48, 51, 52, 120, 55, 0, 86, 120, 74, 483: 78, 9, 10, 16, 0, 0, 93, 65, 121, 71, 484: 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 485: 0, 0, 0, 0, 0, 0, 0, 85, 81, 83, 486: 0, 91, 151, 0, 0, 178, 152, 153, 154, 155, 487: 156, 157, 0, 0, 0, 170, 161, 0, 124, 177, 488: 40, 45, 49, 120, 54, 32, 37, 39, 13, 0, 489: 18, 19, 126, 127, 128, 0, 129, 0, 130, 0, 490: 131, 0, 132, 0, 133, 134, 0, 135, 0, 136, 491: 0, 137, 138, 0, 148, 149, 0, 86, 85, 0, 492: 163, 0, 0, 168, 169, 170, 170, 0, 162, 0, 493: 53, 0, 0, 17, 140, 141, 142, 143, 139, 144, 494: 145, 146, 0, 80, 82, 0, 160, 159, 158, 120, 495: 171, 0, 173, 125, 50, 14, 0, 12, 92, 0, 496: 95, 0, 0, 0, 0, 123, 0, 0, 0, 0, 497: 0, 107, 0, 0, 0, 0, 114, 0, 0, 164, 498: 0, 0, 147, 84, 174, 0, 176, 15, 94, 96, 499: 97, 98, 0, 0, 122, 101, 102, 103, 104, 0, 500: 0, 108, 109, 110, 0, 0, 123, 0, 111, 0, 501: 113, 175, 0, 116, 0, 0, 105, 106, 0, 0, 502: 0, 0, 112, 172, 0, 100, 115, 117, 123, 119, 503: 0, 0, 0, 118, 99 }; 504: # 505: # define YYFLAG -1000 506: # define YYERROR goto yyerrlab 507: # define YYACCEPT return(0) 508: # define YYABORT return(1) 509: 510: /* parser for yacc output */ 511: 512: int yydebug = 0; /* 1 for debugging */ 513: YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */ 514: int yychar = -1; /* current input token number */ 515: int yynerrs = 0; /* number of errors */ 516: short yyerrflag = 0; /* error recovery flag */ 517: 518: yyparse() { 519: 520: short yys[YYMAXDEPTH]; 521: short yyj, yym; 522: register YYSTYPE *yypvt; 523: register short yystate, *yyps, yyn; 524: register YYSTYPE *yypv; 525: register short *yyxi; 526: 527: yystate = 0; 528: yychar = -1; 529: yynerrs = 0; 530: yyerrflag = 0; 531: yyps= &yys[-1]; 532: yypv= &yyv[-1]; 533: 534: yystack: /* put a state and value onto the stack */ 535: 536: if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar ); 537: if( ++yyps> &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); } 538: *yyps = yystate; 539: ++yypv; 540: *yypv = yyval; 541: 542: yynewstate: 543: 544: yyn = yypact[yystate]; 545: 546: if( yyn<= YYFLAG ) goto yydefault; /* simple state */ 547: 548: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0; 549: if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault; 550: 551: if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */ 552: yychar = -1; 553: yyval = yylval; 554: yystate = yyn; 555: if( yyerrflag > 0 ) --yyerrflag; 556: goto yystack; 557: } 558: 559: yydefault: 560: /* default state action */ 561: 562: if( (yyn=yydef[yystate]) == -2 ) { 563: if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0; 564: /* look through exception table */ 565: 566: for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */ 567: 568: while( *(yyxi+=2) >= 0 ){ 569: if( *yyxi == yychar ) break; 570: } 571: if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */ 572: } 573: 574: if( yyn == 0 ){ /* error */ 575: /* error ... attempt to resume parsing */ 576: 577: switch( yyerrflag ){ 578: 579: case 0: /* brand new error */ 580: 581: yyerror( "syntax error" ); 582: yyerrlab: 583: ++yynerrs; 584: 585: case 1: 586: case 2: /* incompletely recovered error ... try again */ 587: 588: yyerrflag = 3; 589: 590: /* find a state where "error" is a legal shift action */ 591: 592: while ( yyps >= yys ) { 593: yyn = yypact[*yyps] + YYERRCODE; 594: if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){ 595: yystate = yyact[yyn]; /* simulate a shift of "error" */ 596: goto yystack; 597: } 598: yyn = yypact[*yyps]; 599: 600: /* the current yyps has no shift onn "error", pop stack */ 601: 602: if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] ); 603: --yyps; 604: --yypv; 605: } 606: 607: /* there is no state on the stack with an error shift ... abort */ 608: 609: yyabort: 610: return(1); 611: 612: 613: case 3: /* no shift yet; clobber input char */ 614: 615: if( yydebug ) printf( "error recovery discards char %d\n", yychar ); 616: 617: if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */ 618: yychar = -1; 619: goto yynewstate; /* try again in the same state */ 620: 621: } 622: 623: } 624: 625: /* reduction by production yyn */ 626: 627: if( yydebug ) printf("reduce %d\n",yyn); 628: yyps -= yyr2[yyn]; 629: yypvt = yypv; 630: yypv -= yyr2[yyn]; 631: yyval = yypv[1]; 632: yym=yyn; 633: /* consult goto table to find next state */ 634: yyn = yyr1[yyn]; 635: yyj = yypgo[yyn] + *yyps + 1; 636: if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]]; 637: switch(yym){ 638: 639: case 2: 640: # line 133 "../mip/cgram.y" 641: ftnend(); break; 642: case 3: 643: # line 136 "../mip/cgram.y" 644: { curclass = SNULL; blevel = 0; } break; 645: case 4: 646: # line 138 "../mip/cgram.y" 647: { curclass = SNULL; blevel = 0; } break; 648: case 5: 649: # line 142 "../mip/cgram.y" 650: { yypvt[-1].nodep->op = FREE; } break; 651: case 6: 652: # line 144 "../mip/cgram.y" 653: { yypvt[-2].nodep->op = FREE; } break; 654: case 7: 655: # line 145 "../mip/cgram.y" 656: { 657: defid( tymerge(yypvt[-1].nodep,yypvt[-0].nodep), curclass==STATIC?STATIC:EXTDEF ); 658: } break; 659: case 8: 660: # line 148 "../mip/cgram.y" 661: { 662: if( blevel ) cerror( "function level error" ); 663: if( reached ) retstat |= NRETVAL; 664: yypvt[-3].nodep->op = FREE; 665: ftnend(); 666: } break; 667: case 11: 668: # line 159 "../mip/cgram.y" 669: { blevel = 1; } break; 670: case 13: 671: # line 164 "../mip/cgram.y" 672: { bccode(); 673: locctr(PROG); 674: } break; 675: case 14: 676: # line 170 "../mip/cgram.y" 677: { yypvt[-1].nodep->op = FREE; } break; 678: case 15: 679: # line 172 "../mip/cgram.y" 680: { yypvt[-2].nodep->op = FREE; } break; 681: case 17: 682: # line 176 "../mip/cgram.y" 683: { curclass = SNULL; yypvt[-2].nodep->op = FREE; } break; 684: case 18: 685: # line 178 "../mip/cgram.y" 686: { curclass = SNULL; yypvt[-1].nodep->op = FREE; } break; 687: case 19: 688: # line 180 "../mip/cgram.y" 689: { curclass = SNULL; } break; 690: case 21: 691: # line 184 "../mip/cgram.y" 692: { yyval.nodep = mkty(INT,0,INT); curclass = SNULL; } break; 693: case 22: 694: # line 187 "../mip/cgram.y" 695: { yyval.nodep = yypvt[-0].nodep; } break; 696: case 24: 697: # line 190 "../mip/cgram.y" 698: { yyval.nodep = mkty(INT,0,INT); } break; 699: case 25: 700: # line 192 "../mip/cgram.y" 701: { curclass = SNULL ; } break; 702: case 26: 703: # line 197 "../mip/cgram.y" 704: { curclass = yypvt[-0].intval; } break; 705: case 28: 706: # line 202 "../mip/cgram.y" 707: { yypvt[-1].nodep->type = types( yypvt[-1].nodep->type, yypvt[-0].nodep->type, UNDEF ); 708: yypvt[-0].nodep->op = FREE; 709: } break; 710: case 29: 711: # line 206 "../mip/cgram.y" 712: { yypvt[-2].nodep->type = types( yypvt[-2].nodep->type, yypvt[-1].nodep->type, yypvt[-0].nodep->type ); 713: yypvt[-1].nodep->op = yypvt[-0].nodep->op = FREE; 714: } break; 715: case 32: 716: # line 214 "../mip/cgram.y" 717: { yyval.nodep = dclstruct(yypvt[-4].intval); } break; 718: case 33: 719: # line 216 "../mip/cgram.y" 720: { yyval.nodep = rstruct(yypvt[-0].intval,0); stwart = instruct; } break; 721: case 34: 722: # line 220 "../mip/cgram.y" 723: { yyval.intval = bstruct(-1,0); } break; 724: case 35: 725: # line 222 "../mip/cgram.y" 726: { yyval.intval = bstruct(yypvt[-0].intval,0); } break; 727: case 38: 728: # line 230 "../mip/cgram.y" 729: { moedef( yypvt[-0].intval ); } break; 730: case 39: 731: # line 232 "../mip/cgram.y" 732: { strucoff = yypvt[-0].intval; moedef( yypvt[-2].intval ); } break; 733: case 40: 734: # line 236 "../mip/cgram.y" 735: { yyval.nodep = dclstruct(yypvt[-4].intval); } break; 736: case 41: 737: # line 238 "../mip/cgram.y" 738: { yyval.nodep = rstruct(yypvt[-0].intval,yypvt[-1].intval); } break; 739: case 42: 740: # line 242 "../mip/cgram.y" 741: { yyval.intval = bstruct(-1,yypvt[-0].intval); stwart=0; } break; 742: case 43: 743: # line 244 "../mip/cgram.y" 744: { yyval.intval = bstruct(yypvt[-0].intval,yypvt[-1].intval); stwart=0; } break; 745: case 46: 746: # line 252 "../mip/cgram.y" 747: { curclass = SNULL; stwart=0; yypvt[-1].nodep->op = FREE; } break; 748: case 47: 749: # line 254 "../mip/cgram.y" 750: { if( curclass != MOU ){ 751: curclass = SNULL; 752: } 753: else { 754: sprintf( fakename, "$%dFAKE", fake++ ); 755: defid( tymerge(yypvt[-0].nodep, bdty(NAME,NIL,lookup( fakename, SMOS ))), curclass ); 756: } 757: stwart = 0; 758: yypvt[-0].nodep->op = FREE; 759: } break; 760: case 48: 761: # line 268 "../mip/cgram.y" 762: { defid( tymerge(yypvt[-1].nodep,yypvt[-0].nodep), curclass); stwart = instruct; } break; 763: case 49: 764: # line 269 "../mip/cgram.y" 765: {yyval.nodep=yypvt[-2].nodep;} break; 766: case 50: 767: # line 270 "../mip/cgram.y" 768: { defid( tymerge(yypvt[-4].nodep,yypvt[-0].nodep), curclass); stwart = instruct; } break; 769: case 53: 770: # line 276 "../mip/cgram.y" 771: { if( !(instruct&INSTRUCT) ) uerror( "field outside of structure" ); 772: if( yypvt[-0].intval<0 || yypvt[-0].intval >= FIELD ){ 773: uerror( "illegal field size" ); 774: yypvt[-0].intval = 1; 775: } 776: defid( tymerge(yypvt[-3].nodep,yypvt[-2].nodep), FIELD|yypvt[-0].intval ); 777: yyval.nodep = NIL; 778: } break; 779: case 54: 780: # line 286 "../mip/cgram.y" 781: { if( !(instruct&INSTRUCT) ) uerror( "field outside of structure" ); 782: falloc( stab, yypvt[-0].intval, -1, yypvt[-2].nodep ); /* alignment or hole */ 783: yyval.nodep = NIL; 784: } break; 785: case 55: 786: # line 291 "../mip/cgram.y" 787: { yyval.nodep = NIL; } break; 788: case 56: 789: # line 296 "../mip/cgram.y" 790: { umul: 791: yyval.nodep = bdty( UNARY MUL, yypvt[-0].nodep, 0 ); } break; 792: case 57: 793: # line 299 "../mip/cgram.y" 794: { uftn: 795: yyval.nodep = bdty( UNARY CALL, yypvt[-2].nodep, 0 ); } break; 796: case 58: 797: # line 302 "../mip/cgram.y" 798: { uary: 799: yyval.nodep = bdty( LB, yypvt[-2].nodep, 0 ); } break; 800: case 59: 801: # line 305 "../mip/cgram.y" 802: { bary: 803: if( (int)yypvt[-1].intval <= 0 ) werror( "zero or negative subscript" ); 804: yyval.nodep = bdty( LB, yypvt[-3].nodep, yypvt[-1].intval ); } break; 805: case 60: 806: # line 309 "../mip/cgram.y" 807: { yyval.nodep = bdty( NAME, NIL, yypvt[-0].intval ); } break; 808: case 61: 809: # line 311 "../mip/cgram.y" 810: { yyval.nodep=yypvt[-1].nodep; } break; 811: case 62: 812: # line 314 "../mip/cgram.y" 813: { goto umul; } break; 814: case 63: 815: # line 316 "../mip/cgram.y" 816: { goto uftn; } break; 817: case 64: 818: # line 318 "../mip/cgram.y" 819: { goto uary; } break; 820: case 65: 821: # line 320 "../mip/cgram.y" 822: { goto bary; } break; 823: case 66: 824: # line 322 "../mip/cgram.y" 825: { yyval.nodep = yypvt[-1].nodep; } break; 826: case 67: 827: # line 324 "../mip/cgram.y" 828: { 829: if( blevel!=0 ) uerror("function declaration in bad context"); 830: yyval.nodep = bdty( UNARY CALL, bdty(NAME,NIL,yypvt[-2].intval), 0 ); 831: stwart = 0; 832: } break; 833: case 68: 834: # line 330 "../mip/cgram.y" 835: { 836: yyval.nodep = bdty( UNARY CALL, bdty(NAME,NIL,yypvt[-1].intval), 0 ); 837: stwart = 0; 838: } break; 839: case 69: 840: # line 337 "../mip/cgram.y" 841: { 842: /* turn off typedefs for argument names */ 843: stwart = SEENAME; 844: } break; 845: case 70: 846: # line 344 "../mip/cgram.y" 847: { ftnarg( yypvt[-0].intval ); stwart = SEENAME; } break; 848: case 71: 849: # line 346 "../mip/cgram.y" 850: { ftnarg( yypvt[-0].intval ); stwart = SEENAME; } break; 851: case 73: 852: # line 351 "../mip/cgram.y" 853: {yyval.nodep=yypvt[-2].nodep;} break; 854: case 75: 855: # line 355 "../mip/cgram.y" 856: { defid( yypvt[-0].nodep = tymerge(yypvt[-1].nodep,yypvt[-0].nodep), curclass); 857: beginit(yypvt[-0].nodep->rval); 858: } break; 859: case 77: 860: # line 362 "../mip/cgram.y" 861: { nidcl( tymerge(yypvt[-1].nodep,yypvt[-0].nodep) ); } break; 862: case 78: 863: # line 364 "../mip/cgram.y" 864: { defid( tymerge(yypvt[-1].nodep,yypvt[-0].nodep), uclass(curclass) ); 865: } break; 866: case 79: 867: # line 368 "../mip/cgram.y" 868: { doinit( yypvt[-0].nodep ); 869: endinit(); } break; 870: case 80: 871: # line 371 "../mip/cgram.y" 872: { endinit(); } break; 873: case 83: 874: # line 380 "../mip/cgram.y" 875: { doinit( yypvt[-0].nodep ); } break; 876: case 84: 877: # line 382 "../mip/cgram.y" 878: { irbrace(); } break; 879: case 89: 880: # line 394 "../mip/cgram.y" 881: { werror( "old-fashioned initialization: use =" ); } break; 882: case 91: 883: # line 399 "../mip/cgram.y" 884: { ilbrace(); } break; 885: case 92: 886: # line 405 "../mip/cgram.y" 887: { --blevel; 888: if( blevel == 1 ) blevel = 0; 889: clearst( blevel ); 890: checkst( blevel ); 891: autooff = *--psavbc; 892: regvar = *--psavbc; 893: } break; 894: case 93: 895: # line 415 "../mip/cgram.y" 896: { if( blevel == 1 ) dclargs(); 897: ++blevel; 898: if( psavbc > &asavbc[BCSZ-2] ) cerror( "nesting too deep" ); 899: *psavbc++ = regvar; 900: *psavbc++ = autooff; 901: } break; 902: case 94: 903: # line 424 "../mip/cgram.y" 904: { ecomp( yypvt[-1].nodep ); } break; 905: case 96: 906: # line 427 "../mip/cgram.y" 907: { deflab(yypvt[-1].intval); 908: reached = 1; 909: } break; 910: case 97: 911: # line 431 "../mip/cgram.y" 912: { if( yypvt[-1].intval != NOLAB ){ 913: deflab( yypvt[-1].intval ); 914: reached = 1; 915: } 916: } break; 917: case 98: 918: # line 437 "../mip/cgram.y" 919: { branch( contlab ); 920: deflab( brklab ); 921: if( (flostat&FBRK) || !(flostat&FLOOP)) reached = 1; 922: else reached = 0; 923: resetbc(0); 924: } break; 925: case 99: 926: # line 444 "../mip/cgram.y" 927: { deflab( contlab ); 928: if( flostat & FCONT ) reached = 1; 929: ecomp( buildtree( CBRANCH, buildtree( NOT, yypvt[-2].nodep, NIL ), bcon( yypvt[-6].intval ) ) ); 930: deflab( brklab ); 931: reached = 1; 932: resetbc(0); 933: } break; 934: case 100: 935: # line 452 "../mip/cgram.y" 936: { deflab( contlab ); 937: if( flostat&FCONT ) reached = 1; 938: if( yypvt[-2].nodep ) ecomp( yypvt[-2].nodep ); 939: branch( yypvt[-3].intval ); 940: deflab( brklab ); 941: if( (flostat&FBRK) || !(flostat&FLOOP) ) reached = 1; 942: else reached = 0; 943: resetbc(0); 944: } break; 945: case 101: 946: # line 462 "../mip/cgram.y" 947: { if( reached ) branch( brklab ); 948: deflab( yypvt[-1].intval ); 949: swend(); 950: deflab(brklab); 951: if( (flostat&FBRK) || !(flostat&FDEF) ) reached = 1; 952: resetbc(FCONT); 953: } break; 954: case 102: 955: # line 470 "../mip/cgram.y" 956: { if( brklab == NOLAB ) uerror( "illegal break"); 957: else if(reached) branch( brklab ); 958: flostat |= FBRK; 959: if( brkflag ) goto rch; 960: reached = 0; 961: } break; 962: case 103: 963: # line 477 "../mip/cgram.y" 964: { if( contlab == NOLAB ) uerror( "illegal continue"); 965: else branch( contlab ); 966: flostat |= FCONT; 967: goto rch; 968: } break; 969: case 104: 970: # line 483 "../mip/cgram.y" 971: { retstat |= NRETVAL; 972: branch( retlab ); 973: rch: 974: if( !reached ) werror( "statement not reached"); 975: reached = 0; 976: } break; 977: case 105: 978: # line 490 "../mip/cgram.y" 979: { register NODE *temp; 980: idname = curftn; 981: temp = buildtree( NAME, NIL, NIL ); 982: temp->type = DECREF( temp->type ); 983: temp = buildtree( RETURN, temp, yypvt[-1].nodep ); 984: /* now, we have the type of the RHS correct */ 985: temp->left->op = FREE; 986: temp->op = FREE; 987: ecomp( buildtree( FORCE, temp->right, NIL ) ); 988: retstat |= RETVAL; 989: branch( retlab ); 990: reached = 0; 991: } break; 992: case 106: 993: # line 504 "../mip/cgram.y" 994: { register NODE *q; 995: q = block( FREE, NIL, NIL, INT|ARY, 0, INT ); 996: q->rval = idname = yypvt[-1].intval; 997: defid( q, ULABEL ); 998: stab[idname].suse = -lineno; 999: branch( stab[idname].offset ); 1000: goto rch; 1001: } break; 1002: case 111: 1003: # line 518 "../mip/cgram.y" 1004: { register NODE *q; 1005: q = block( FREE, NIL, NIL, INT|ARY, 0, LABEL ); 1006: q->rval = yypvt[-1].intval; 1007: defid( q, LABEL ); 1008: reached = 1; 1009: } break; 1010: case 112: 1011: # line 525 "../mip/cgram.y" 1012: { addcase(yypvt[-1].nodep); 1013: reached = 1; 1014: } break; 1015: case 113: 1016: # line 529 "../mip/cgram.y" 1017: { reached = 1; 1018: adddef(); 1019: flostat |= FDEF; 1020: } break; 1021: case 114: 1022: # line 535 "../mip/cgram.y" 1023: { savebc(); 1024: if( !reached ) werror( "loop not entered at top"); 1025: brklab = getlab(); 1026: contlab = getlab(); 1027: deflab( yyval.intval = getlab() ); 1028: reached = 1; 1029: } break; 1030: case 115: 1031: # line 544 "../mip/cgram.y" 1032: { ecomp( buildtree( CBRANCH, yypvt[-1].nodep, bcon( yyval.intval=getlab()) ) ) ; 1033: reached = 1; 1034: } break; 1035: case 116: 1036: # line 549 "../mip/cgram.y" 1037: { if( reached ) branch( yyval.intval = getlab() ); 1038: else yyval.intval = NOLAB; 1039: deflab( yypvt[-2].intval ); 1040: reached = 1; 1041: } break; 1042: case 117: 1043: # line 557 "../mip/cgram.y" 1044: { savebc(); 1045: if( !reached ) werror( "loop not entered at top"); 1046: if( yypvt[-1].nodep->op == ICON && yypvt[-1].nodep->lval != 0 ) flostat = FLOOP; 1047: deflab( contlab = getlab() ); 1048: reached = 1; 1049: brklab = getlab(); 1050: if( flostat == FLOOP ) tfree( yypvt[-1].nodep ); 1051: else ecomp( buildtree( CBRANCH, yypvt[-1].nodep, bcon( brklab) ) ); 1052: } break; 1053: case 118: 1054: # line 568 "../mip/cgram.y" 1055: { if( yypvt[-3].nodep ) ecomp( yypvt[-3].nodep ); 1056: else if( !reached ) werror( "loop not entered at top"); 1057: savebc(); 1058: contlab = getlab(); 1059: brklab = getlab(); 1060: deflab( yyval.intval = getlab() ); 1061: reached = 1; 1062: if( yypvt[-1].nodep ) ecomp( buildtree( CBRANCH, yypvt[-1].nodep, bcon( brklab) ) ); 1063: else flostat |= FLOOP; 1064: } break; 1065: case 119: 1066: # line 580 "../mip/cgram.y" 1067: { savebc(); 1068: brklab = getlab(); 1069: ecomp( buildtree( FORCE, yypvt[-1].nodep, NIL ) ); 1070: branch( yyval.intval = getlab() ); 1071: swstart(); 1072: reached = 0; 1073: } break; 1074: case 120: 1075: # line 589 "../mip/cgram.y" 1076: { yyval.intval=instruct; stwart=instruct=0; } break; 1077: case 121: 1078: # line 591 "../mip/cgram.y" 1079: { yyval.intval = icons( yypvt[-0].nodep ); instruct=yypvt[-1].intval; } break; 1080: case 123: 1081: # line 595 "../mip/cgram.y" 1082: { yyval.nodep=0; } break; 1083: case 125: 1084: # line 600 "../mip/cgram.y" 1085: { goto bop; } break; 1086: case 126: 1087: # line 604 "../mip/cgram.y" 1088: { 1089: preconf: 1090: if( yychar==RELOP||yychar==EQUOP||yychar==AND||yychar==OR||yychar==ER ){ 1091: precplaint: 1092: if( hflag ) werror( "precedence confusion possible: parenthesize!" ); 1093: } 1094: bop: 1095: yyval.nodep = buildtree( yypvt[-1].intval, yypvt[-2].nodep, yypvt[-0].nodep ); 1096: } break; 1097: case 127: 1098: # line 614 "../mip/cgram.y" 1099: { yypvt[-1].intval = COMOP; 1100: goto bop; 1101: } break; 1102: case 128: 1103: # line 618 "../mip/cgram.y" 1104: { goto bop; } break; 1105: case 129: 1106: # line 620 "../mip/cgram.y" 1107: { if(yychar==SHIFTOP) goto precplaint; else goto bop; } break; 1108: case 130: 1109: # line 622 "../mip/cgram.y" 1110: { if(yychar==SHIFTOP ) goto precplaint; else goto bop; } break; 1111: case 131: 1112: # line 624 "../mip/cgram.y" 1113: { if(yychar==PLUS||yychar==MINUS) goto precplaint; else goto bop; } break; 1114: case 132: 1115: # line 626 "../mip/cgram.y" 1116: { goto bop; } break; 1117: case 133: 1118: # line 628 "../mip/cgram.y" 1119: { goto preconf; } break; 1120: case 134: 1121: # line 630 "../mip/cgram.y" 1122: { if( yychar==RELOP||yychar==EQUOP ) goto preconf; else goto bop; } break; 1123: case 135: 1124: # line 632 "../mip/cgram.y" 1125: { if(yychar==RELOP||yychar==EQUOP) goto preconf; else goto bop; } break; 1126: case 136: 1127: # line 634 "../mip/cgram.y" 1128: { if(yychar==RELOP||yychar==EQUOP) goto preconf; else goto bop; } break; 1129: case 137: 1130: # line 636 "../mip/cgram.y" 1131: { goto bop; } break; 1132: case 138: 1133: # line 638 "../mip/cgram.y" 1134: { goto bop; } break; 1135: case 139: 1136: # line 640 "../mip/cgram.y" 1137: { abop: 1138: yyval.nodep = buildtree( ASG yypvt[-2].intval, yypvt[-3].nodep, yypvt[-0].nodep ); 1139: } break; 1140: case 140: 1141: # line 644 "../mip/cgram.y" 1142: { goto abop; } break; 1143: case 141: 1144: # line 646 "../mip/cgram.y" 1145: { goto abop; } break; 1146: case 142: 1147: # line 648 "../mip/cgram.y" 1148: { goto abop; } break; 1149: case 143: 1150: # line 650 "../mip/cgram.y" 1151: { goto abop; } break; 1152: case 144: 1153: # line 652 "../mip/cgram.y" 1154: { goto abop; } break; 1155: case 145: 1156: # line 654 "../mip/cgram.y" 1157: { goto abop; } break; 1158: case 146: 1159: # line 656 "../mip/cgram.y" 1160: { goto abop; } break; 1161: case 147: 1162: # line 658 "../mip/cgram.y" 1163: { yyval.nodep=buildtree(QUEST, yypvt[-4].nodep, buildtree( COLON, yypvt[-2].nodep, yypvt[-0].nodep ) ); 1164: } break; 1165: case 148: 1166: # line 661 "../mip/cgram.y" 1167: { werror( "old-fashioned assignment operator" ); goto bop; } break; 1168: case 149: 1169: # line 663 "../mip/cgram.y" 1170: { goto bop; } break; 1171: case 151: 1172: # line 667 "../mip/cgram.y" 1173: { yyval.nodep = buildtree( yypvt[-0].intval, yypvt[-1].nodep, bcon(1) ); } break; 1174: case 152: 1175: # line 669 "../mip/cgram.y" 1176: { ubop: 1177: yyval.nodep = buildtree( UNARY yypvt[-1].intval, yypvt[-0].nodep, NIL ); 1178: } break; 1179: case 153: 1180: # line 673 "../mip/cgram.y" 1181: { if( ISFTN(yypvt[-0].nodep->type) || ISARY(yypvt[-0].nodep->type) ){ 1182: werror( "& before array or function: ignored" ); 1183: yyval.nodep = yypvt[-0].nodep; 1184: } 1185: else goto ubop; 1186: } break; 1187: case 154: 1188: # line 680 "../mip/cgram.y" 1189: { goto ubop; } break; 1190: case 155: 1191: # line 682 "../mip/cgram.y" 1192: { 1193: yyval.nodep = buildtree( yypvt[-1].intval, yypvt[-0].nodep, NIL ); 1194: } break; 1195: case 156: 1196: # line 686 "../mip/cgram.y" 1197: { yyval.nodep = buildtree( yypvt[-1].intval==INCR ? ASG PLUS : ASG MINUS, 1198: yypvt[-0].nodep, 1199: bcon(1) ); 1200: } break; 1201: case 157: 1202: # line 691 "../mip/cgram.y" 1203: { yyval.nodep = doszof( yypvt[-0].nodep ); } break; 1204: case 158: 1205: # line 693 "../mip/cgram.y" 1206: { yyval.nodep = buildtree( CAST, yypvt[-2].nodep, yypvt[-0].nodep ); 1207: yyval.nodep->left->op = FREE; 1208: yyval.nodep->op = FREE; 1209: yyval.nodep = yyval.nodep->right; 1210: } break; 1211: case 159: 1212: # line 699 "../mip/cgram.y" 1213: { yyval.nodep = doszof( yypvt[-1].nodep ); } break; 1214: case 160: 1215: # line 701 "../mip/cgram.y" 1216: { yyval.nodep = buildtree( UNARY MUL, buildtree( PLUS, yypvt[-3].nodep, yypvt[-1].nodep ), NIL ); } break; 1217: case 161: 1218: # line 703 "../mip/cgram.y" 1219: { yyval.nodep=buildtree(UNARY CALL,yypvt[-1].nodep,NIL); } break; 1220: case 162: 1221: # line 705 "../mip/cgram.y" 1222: { yyval.nodep=buildtree(CALL,yypvt[-2].nodep,yypvt[-1].nodep); } break; 1223: case 163: 1224: # line 707 "../mip/cgram.y" 1225: { if( yypvt[-1].intval == DOT ){ 1226: yypvt[-2].nodep = buildtree( UNARY AND, yypvt[-2].nodep, NIL ); 1227: } 1228: idname = yypvt[-0].intval; 1229: yyval.nodep = buildtree( STREF, yypvt[-2].nodep, buildtree( NAME, NIL, NIL ) ); 1230: } break; 1231: case 164: 1232: # line 714 "../mip/cgram.y" 1233: { idname = yypvt[-0].intval; 1234: /* recognize identifiers in initializations */ 1235: if( blevel==0 && stab[idname].stype == UNDEF ) { 1236: register NODE *q; 1237: werror( "undeclared initializer name %.8s", stab[idname].sname ); 1238: q = block( FREE, NIL, NIL, INT, 0, INT ); 1239: q->rval = idname; 1240: defid( q, EXTERN ); 1241: } 1242: yyval.nodep=buildtree(NAME,NIL,NIL); 1243: stab[yypvt[-0].intval].suse = -lineno; 1244: } break; 1245: case 165: 1246: # line 727 "../mip/cgram.y" 1247: { yyval.nodep=bcon(0); 1248: yyval.nodep->lval = lastcon; 1249: yyval.nodep->rval = NONAME; 1250: if( yypvt[-0].intval ) yyval.nodep->csiz = yyval.nodep->type = ctype(LONG); 1251: } break; 1252: case 166: 1253: # line 733 "../mip/cgram.y" 1254: { yyval.nodep=buildtree(FCON,NIL,NIL); 1255: yyval.nodep->dval = dcon; 1256: } break; 1257: case 167: 1258: # line 737 "../mip/cgram.y" 1259: { yyval.nodep = getstr(); /* get string contents */ } break; 1260: case 168: 1261: # line 739 "../mip/cgram.y" 1262: { yyval.nodep=yypvt[-1].nodep; } break; 1263: case 169: 1264: # line 743 "../mip/cgram.y" 1265: { 1266: yyval.nodep = tymerge( yypvt[-1].nodep, yypvt[-0].nodep ); 1267: yyval.nodep->op = NAME; 1268: yypvt[-1].nodep->op = FREE; 1269: } break; 1270: case 170: 1271: # line 751 "../mip/cgram.y" 1272: { yyval.nodep = bdty( NAME, NIL, -1 ); } break; 1273: case 171: 1274: # line 753 "../mip/cgram.y" 1275: { yyval.nodep = bdty( UNARY CALL, bdty(NAME,NIL,-1),0); } break; 1276: case 172: 1277: # line 755 "../mip/cgram.y" 1278: { yyval.nodep = bdty( UNARY CALL, yypvt[-3].nodep, 0 ); } break; 1279: case 173: 1280: # line 757 "../mip/cgram.y" 1281: { goto umul; } break; 1282: case 174: 1283: # line 759 "../mip/cgram.y" 1284: { goto uary; } break; 1285: case 175: 1286: # line 761 "../mip/cgram.y" 1287: { goto bary; } break; 1288: case 176: 1289: # line 763 "../mip/cgram.y" 1290: { yyval.nodep = yypvt[-1].nodep; } break; 1291: case 177: 1292: # line 767 "../mip/cgram.y" 1293: { if( stab[yypvt[-1].intval].stype == UNDEF ){ 1294: register NODE *q; 1295: q = block( FREE, NIL, NIL, FTN|INT, 0, INT ); 1296: q->rval = yypvt[-1].intval; 1297: defid( q, EXTERN ); 1298: } 1299: idname = yypvt[-1].intval; 1300: yyval.nodep=buildtree(NAME,NIL,NIL); 1301: stab[idname].suse = -lineno; 1302: } break; 1303: } 1304: goto yystack; /* stack new state and value */ 1305: 1306: }