|
|
1.1 ! root 1: ! 2: ! 3: /* A Bison parser, made from asm.y */ ! 4: ! 5: ! 6: ! 7: #define YYBISON 1 /* Identify Bison output. */ ! 8: ! 9: ! 10: ! 11: #define WORD 258 ! 12: ! 13: #define WHITESP 259 ! 14: ! 15: #define EOLN 260 ! 16: ! 17: #define STRING 261 ! 18: ! 19: #define DEFINECMD 262 ! 20: ! 21: #define INCLUDECMD 263 ! 22: ! 23: #define IFDEFCMD 264 ! 24: ! 25: #define IFNDEFCMD 265 ! 26: ! 27: #define ELSECMD 266 ! 28: ! 29: #define ENDIFCMD 267 ! 30: ! 31: ! 32: ! 33: #line 3 "asm.y" ! 34: ! 35: ! 36: ! 37: #define YYSTYPE char * ! 38: ! 39: ! 40: ! 41: #include "asmtrans.h" ! 42: ! 43: ! 44: ! 45: #ifndef YYLTYPE ! 46: ! 47: typedef ! 48: ! 49: struct yyltype ! 50: ! 51: { ! 52: ! 53: int timestamp; ! 54: ! 55: int first_line; ! 56: ! 57: int first_column; ! 58: ! 59: int last_line; ! 60: ! 61: int last_column; ! 62: ! 63: char *text; ! 64: ! 65: } ! 66: ! 67: yyltype; ! 68: ! 69: ! 70: ! 71: #define YYLTYPE yyltype ! 72: ! 73: #endif ! 74: ! 75: ! 76: ! 77: #ifndef YYSTYPE ! 78: ! 79: #define YYSTYPE int ! 80: ! 81: #endif ! 82: ! 83: #include <stdio.h> ! 84: ! 85: ! 86: ! 87: #ifndef __STDC__ ! 88: ! 89: #define const ! 90: ! 91: #endif ! 92: ! 93: ! 94: ! 95: ! 96: ! 97: ! 98: ! 99: #define YYFINAL 87 ! 100: ! 101: #define YYFLAG -32768 ! 102: ! 103: #define YYNTBASE 25 ! 104: ! 105: ! 106: ! 107: #define YYTRANSLATE(x) ((unsigned)(x) <= 267 ? yytranslate[x] : 35) ! 108: ! 109: ! 110: ! 111: static const char yytranslate[] = { 0, ! 112: ! 113: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 114: ! 115: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 116: ! 117: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 118: ! 119: 2, 2, 2, 2, 15, 22, 2, 2, 2, 16, ! 120: ! 121: 17, 23, 18, 13, 19, 2, 24, 2, 2, 2, ! 122: ! 123: 2, 2, 2, 2, 2, 2, 2, 14, 2, 2, ! 124: ! 125: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 126: ! 127: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 128: ! 129: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 130: ! 131: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 132: ! 133: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 134: ! 135: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 136: ! 137: 2, 2, 20, 2, 21, 2, 2, 2, 2, 2, ! 138: ! 139: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 140: ! 141: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 142: ! 143: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 144: ! 145: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 146: ! 147: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 148: ! 149: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 150: ! 151: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 152: ! 153: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 154: ! 155: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 156: ! 157: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 158: ! 159: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 160: ! 161: 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ! 162: ! 163: 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, ! 164: ! 165: 6, 7, 8, 9, 10, 11, 12 ! 166: ! 167: }; ! 168: ! 169: ! 170: ! 171: #if YYDEBUG != 0 ! 172: ! 173: static const short yyprhs[] = { 0, ! 174: ! 175: 0, 1, 4, 6, 9, 12, 16, 21, 26, 33, ! 176: ! 177: 40, 45, 50, 53, 56, 59, 64, 68, 74, 76, ! 178: ! 179: 80, 82, 85, 87, 90, 94, 99, 104, 109, 114, ! 180: ! 181: 121, 128, 130, 134, 137, 139, 142, 144, 146, 148 ! 182: ! 183: }; ! 184: ! 185: ! 186: ! 187: #endif ! 188: ! 189: ! 190: ! 191: static const short yyrhs[] = { -1, ! 192: ! 193: 25, 26, 0, 5, 0, 30, 5, 0, 27, 5, ! 194: ! 195: 0, 30, 27, 5, 0, 8, 4, 6, 5, 0, ! 196: ! 197: 8, 4, 3, 5, 0, 7, 4, 3, 4, 6, ! 198: ! 199: 5, 0, 7, 4, 3, 4, 31, 5, 0, 9, ! 200: ! 201: 4, 3, 5, 0, 10, 4, 3, 5, 0, 11, ! 202: ! 203: 5, 0, 12, 5, 0, 4, 29, 0, 4, 29, ! 204: ! 205: 4, 28, 0, 3, 4, 29, 0, 3, 4, 29, ! 206: ! 207: 4, 28, 0, 31, 0, 31, 13, 28, 0, 3, ! 208: ! 209: 0, 3, 14, 0, 32, 0, 15, 32, 0, 16, ! 210: ! 211: 32, 17, 0, 16, 32, 17, 18, 0, 19, 16, ! 212: ! 213: 32, 17, 0, 32, 16, 32, 17, 0, 16, 32, ! 214: ! 215: 17, 3, 0, 32, 16, 32, 13, 32, 17, 0, ! 216: ! 217: 32, 20, 32, 14, 32, 21, 0, 33, 0, 33, ! 218: ! 219: 34, 32, 0, 19, 32, 0, 3, 0, 22, 3, ! 220: ! 221: 0, 18, 0, 19, 0, 23, 0, 24, 0 ! 222: ! 223: }; ! 224: ! 225: ! 226: ! 227: #if YYDEBUG != 0 ! 228: ! 229: static const short yyrline[] = { 0, ! 230: ! 231: 22, 23, 26, 29, 30, 31, 33, 34, 35, 37, ! 232: ! 233: 39, 40, 41, 42, 45, 46, 49, 50, 55, 56, ! 234: ! 235: 60, 63, 65, 66, 67, 68, 69, 70, 71, 72, ! 236: ! 237: 74, 78, 79, 80, 82, 83, 86, 87, 88, 89 ! 238: ! 239: }; ! 240: ! 241: ! 242: ! 243: static const char * const yytname[] = { "$","error","$illegal.","WORD","WHITESP", ! 244: ! 245: "EOLN","STRING","DEFINECMD","INCLUDECMD","IFDEFCMD","IFNDEFCMD","ELSECMD","ENDIFCMD", ! 246: ! 247: "','","':'","'#'","'('","')'","'+'","'-'","'{'","'}'","'$'","'*'","'/'","input", ! 248: ! 249: "line","opline","ops","opcode","label","operand","basic","basexpr","op","" ! 250: ! 251: }; ! 252: ! 253: #endif ! 254: ! 255: ! 256: ! 257: static const short yyr1[] = { 0, ! 258: ! 259: 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, ! 260: ! 261: 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, ! 262: ! 263: 29, 30, 31, 31, 31, 31, 31, 31, 31, 31, ! 264: ! 265: 31, 32, 32, 32, 33, 33, 34, 34, 34, 34 ! 266: ! 267: }; ! 268: ! 269: ! 270: ! 271: static const short yyr2[] = { 0, ! 272: ! 273: 0, 2, 1, 2, 2, 3, 4, 4, 6, 6, ! 274: ! 275: 4, 4, 2, 2, 2, 4, 3, 5, 1, 3, ! 276: ! 277: 1, 2, 1, 2, 3, 4, 4, 4, 4, 6, ! 278: ! 279: 6, 1, 3, 2, 1, 2, 1, 1, 1, 1 ! 280: ! 281: }; ! 282: ! 283: ! 284: ! 285: static const short yydefact[] = { 1, ! 286: ! 287: 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, ! 288: ! 289: 2, 0, 0, 0, 22, 21, 15, 0, 0, 0, ! 290: ! 291: 0, 13, 14, 5, 0, 4, 0, 17, 0, 0, ! 292: ! 293: 0, 0, 0, 0, 6, 0, 35, 0, 0, 0, ! 294: ! 295: 0, 16, 19, 23, 32, 0, 8, 7, 11, 12, ! 296: ! 297: 18, 0, 24, 0, 0, 34, 36, 0, 0, 0, ! 298: ! 299: 37, 38, 39, 40, 0, 0, 0, 25, 0, 20, ! 300: ! 301: 0, 0, 33, 9, 10, 29, 26, 27, 0, 28, ! 302: ! 303: 0, 0, 0, 30, 31, 0, 0 ! 304: ! 305: }; ! 306: ! 307: ! 308: ! 309: static const short yydefgoto[] = { 1, ! 310: ! 311: 11, 12, 42, 17, 13, 43, 44, 45, 65 ! 312: ! 313: }; ! 314: ! 315: ! 316: ! 317: static const short yypact[] = {-32768, ! 318: ! 319: 47, 1, 3,-32768, 44, 49, 56, 57, 58, 59, ! 320: ! 321: -32768, 60, 8, 3,-32768,-32768, 62, 64, 30, 65, ! 322: ! 323: 66,-32768,-32768,-32768, 67,-32768, 68, 70, 13, 71, ! 324: ! 325: 72, 73, 74, 75,-32768, 13,-32768, 27, 27, 15, ! 326: ! 327: 69,-32768, 63, -12, 21, 4,-32768,-32768,-32768,-32768, ! 328: ! 329: -32768, 27,-32768, 45, 27,-32768,-32768, 13, 27, 27, ! 330: ! 331: -32768,-32768,-32768,-32768, 27, 76, 77, 6, 53,-32768, ! 332: ! 333: 25, 78,-32768,-32768,-32768,-32768,-32768,-32768, 27,-32768, ! 334: ! 335: 27, 79, 80,-32768,-32768, 83,-32768 ! 336: ! 337: }; ! 338: ! 339: ! 340: ! 341: static const short yypgoto[] = {-32768, ! 342: ! 343: -32768, 81, -33, 84,-32768, 38, -38,-32768,-32768 ! 344: ! 345: }; ! 346: ! 347: ! 348: ! 349: ! 350: ! 351: #define YYLAST 101 ! 352: ! 353: ! 354: ! 355: ! 356: ! 357: static const short yytable[] = { 53, ! 358: ! 359: 54, 56, 51, 59, 14, 16, 37, 60, 76, 66, ! 360: ! 361: 25, 3, 26, 56, 15, 37, 69, 37, 38, 39, ! 362: ! 363: 71, 72, 40, 77, 70, 41, 73, 38, 39, 37, ! 364: ! 365: 55, 40, 31, 52, 41, 32, 41, 79, 61, 62, ! 366: ! 367: 82, 80, 83, 63, 64, 52, 86, 18, 41, 2, ! 368: ! 369: 3, 4, 19, 5, 6, 7, 8, 9, 10, 20, ! 370: ! 371: 21, 68, 22, 23, 24, 29, 30, 33, 34, 78, ! 372: ! 373: 14, 57, 35, 36, 46, 58, 47, 48, 49, 50, ! 374: ! 375: 74, 75, 87, 67, 0, 0, 0, 0, 0, 0, ! 376: ! 377: 0, 81, 0, 27, 0, 84, 0, 28, 0, 0, ! 378: ! 379: 85 ! 380: ! 381: }; ! 382: ! 383: ! 384: ! 385: static const short yycheck[] = { 38, ! 386: ! 387: 39, 40, 36, 16, 4, 3, 3, 20, 3, 6, ! 388: ! 389: 3, 4, 5, 52, 14, 3, 55, 3, 15, 16, ! 390: ! 391: 59, 60, 19, 18, 58, 22, 65, 15, 16, 3, ! 392: ! 393: 16, 19, 3, 19, 22, 6, 22, 13, 18, 19, ! 394: ! 395: 79, 17, 81, 23, 24, 19, 0, 4, 22, 3, ! 396: ! 397: 4, 5, 4, 7, 8, 9, 10, 11, 12, 4, ! 398: ! 399: 4, 17, 5, 5, 5, 4, 3, 3, 3, 17, ! 400: ! 401: 4, 3, 5, 4, 4, 13, 5, 5, 5, 5, ! 402: ! 403: 5, 5, 0, 46, -1, -1, -1, -1, -1, -1, ! 404: ! 405: -1, 14, -1, 13, -1, 17, -1, 14, -1, -1, ! 406: ! 407: 21 ! 408: ! 409: }; ! 410: ! 411: /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ ! 412: ! 413: #line 3 "bison.simple" ! 414: ! 415: ! 416: ! 417: /* Skeleton output parser for bison, ! 418: ! 419: Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman ! 420: ! 421: ! 422: ! 423: This program is free software; you can redistribute it and/or modify ! 424: ! 425: it under the terms of the GNU General Public License as published by ! 426: ! 427: the Free Software Foundation; either version 1, or (at your option) ! 428: ! 429: any later version. ! 430: ! 431: ! 432: ! 433: This program is distributed in the hope that it will be useful, ! 434: ! 435: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 436: ! 437: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 438: ! 439: GNU General Public License for more details. ! 440: ! 441: ! 442: ! 443: You should have received a copy of the GNU General Public License ! 444: ! 445: along with this program; if not, write to the Free Software ! 446: ! 447: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ ! 448: ! 449: ! 450: ! 451: ! 452: ! 453: #ifndef alloca ! 454: ! 455: #ifdef __GNUC__ ! 456: ! 457: #define alloca __builtin_alloca ! 458: ! 459: #else /* not GNU C. */ ! 460: ! 461: #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) ! 462: ! 463: #include <alloca.h> ! 464: ! 465: #else /* not sparc */ ! 466: ! 467: #if defined (MSDOS) && !defined (__TURBOC__) ! 468: ! 469: #include <malloc.h> ! 470: ! 471: #else /* not MSDOS, or __TURBOC__ */ ! 472: ! 473: #if defined(_AIX) ! 474: ! 475: #include <malloc.h> ! 476: ! 477: #pragma alloca ! 478: ! 479: #endif /* not _AIX */ ! 480: ! 481: #endif /* not MSDOS, or __TURBOC__ */ ! 482: ! 483: #endif /* not sparc. */ ! 484: ! 485: #endif /* not GNU C. */ ! 486: ! 487: #endif /* alloca not defined. */ ! 488: ! 489: ! 490: ! 491: /* This is the parser code that is written into each bison parser ! 492: ! 493: when the %semantic_parser declaration is not specified in the grammar. ! 494: ! 495: It was written by Richard Stallman by simplifying the hairy parser ! 496: ! 497: used when %semantic_parser is specified. */ ! 498: ! 499: ! 500: ! 501: /* Note: there must be only one dollar sign in this file. ! 502: ! 503: It is replaced by the list of actions, each action ! 504: ! 505: as one case of the switch. */ ! 506: ! 507: ! 508: ! 509: #define yyerrok (yyerrstatus = 0) ! 510: ! 511: #define yyclearin (yychar = YYEMPTY) ! 512: ! 513: #define YYEMPTY -2 ! 514: ! 515: #define YYEOF 0 ! 516: ! 517: #define YYACCEPT return(0) ! 518: ! 519: #define YYABORT return(1) ! 520: ! 521: #define YYERROR goto yyerrlab1 ! 522: ! 523: /* Like YYERROR except do call yyerror. ! 524: ! 525: This remains here temporarily to ease the ! 526: ! 527: transition to the new meaning of YYERROR, for GCC. ! 528: ! 529: Once GCC version 2 has supplanted version 1, this can go. */ ! 530: ! 531: #define YYFAIL goto yyerrlab ! 532: ! 533: #define YYRECOVERING() (!!yyerrstatus) ! 534: ! 535: #define YYBACKUP(token, value) \ ! 536: ! 537: do \ ! 538: ! 539: if (yychar == YYEMPTY && yylen == 1) \ ! 540: ! 541: { yychar = (token), yylval = (value); \ ! 542: ! 543: yychar1 = YYTRANSLATE (yychar); \ ! 544: ! 545: YYPOPSTACK; \ ! 546: ! 547: goto yybackup; \ ! 548: ! 549: } \ ! 550: ! 551: else \ ! 552: ! 553: { yyerror ("syntax error: cannot back up"); YYERROR; } \ ! 554: ! 555: while (0) ! 556: ! 557: ! 558: ! 559: #define YYTERROR 1 ! 560: ! 561: #define YYERRCODE 256 ! 562: ! 563: ! 564: ! 565: #ifndef YYPURE ! 566: ! 567: #define YYLEX yylex() ! 568: ! 569: #endif ! 570: ! 571: ! 572: ! 573: #ifdef YYPURE ! 574: ! 575: #ifdef YYLSP_NEEDED ! 576: ! 577: #define YYLEX yylex(&yylval, &yylloc) ! 578: ! 579: #else ! 580: ! 581: #define YYLEX yylex(&yylval) ! 582: ! 583: #endif ! 584: ! 585: #endif ! 586: ! 587: ! 588: ! 589: /* If nonreentrant, generate the variables here */ ! 590: ! 591: ! 592: ! 593: #ifndef YYPURE ! 594: ! 595: ! 596: ! 597: int yychar; /* the lookahead symbol */ ! 598: ! 599: YYSTYPE yylval; /* the semantic value of the */ ! 600: ! 601: /* lookahead symbol */ ! 602: ! 603: ! 604: ! 605: #ifdef YYLSP_NEEDED ! 606: ! 607: YYLTYPE yylloc; /* location data for the lookahead */ ! 608: ! 609: /* symbol */ ! 610: ! 611: #endif ! 612: ! 613: ! 614: ! 615: int yynerrs; /* number of parse errors so far */ ! 616: ! 617: #endif /* not YYPURE */ ! 618: ! 619: ! 620: ! 621: #if YYDEBUG != 0 ! 622: ! 623: int yydebug; /* nonzero means print parse trace */ ! 624: ! 625: /* Since this is uninitialized, it does not stop multiple parsers ! 626: ! 627: from coexisting. */ ! 628: ! 629: #endif ! 630: ! 631: ! 632: ! 633: /* YYINITDEPTH indicates the initial size of the parser's stacks */ ! 634: ! 635: ! 636: ! 637: #ifndef YYINITDEPTH ! 638: ! 639: #define YYINITDEPTH 200 ! 640: ! 641: #endif ! 642: ! 643: ! 644: ! 645: /* YYMAXDEPTH is the maximum size the stacks can grow to ! 646: ! 647: (effective only if the built-in stack extension method is used). */ ! 648: ! 649: ! 650: ! 651: #if YYMAXDEPTH == 0 ! 652: ! 653: #undef YYMAXDEPTH ! 654: ! 655: #endif ! 656: ! 657: ! 658: ! 659: #ifndef YYMAXDEPTH ! 660: ! 661: #define YYMAXDEPTH 10000 ! 662: ! 663: #endif ! 664: ! 665: ! 666: ! 667: #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ ! 668: ! 669: #define __yy_bcopy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) ! 670: ! 671: #else /* not GNU C or C++ */ ! 672: ! 673: #ifndef __cplusplus ! 674: ! 675: ! 676: ! 677: /* This is the most reliable way to avoid incompatibilities ! 678: ! 679: in available built-in functions on various systems. */ ! 680: ! 681: static void ! 682: ! 683: __yy_bcopy (from, to, count) ! 684: ! 685: char *from; ! 686: ! 687: char *to; ! 688: ! 689: int count; ! 690: ! 691: { ! 692: ! 693: register char *f = from; ! 694: ! 695: register char *t = to; ! 696: ! 697: register int i = count; ! 698: ! 699: ! 700: ! 701: while (i-- > 0) ! 702: ! 703: *t++ = *f++; ! 704: ! 705: } ! 706: ! 707: ! 708: ! 709: #else /* __cplusplus */ ! 710: ! 711: ! 712: ! 713: /* This is the most reliable way to avoid incompatibilities ! 714: ! 715: in available built-in functions on various systems. */ ! 716: ! 717: static void ! 718: ! 719: __yy_bcopy (char *from, char *to, int count) ! 720: ! 721: { ! 722: ! 723: register char *f = from; ! 724: ! 725: register char *t = to; ! 726: ! 727: register int i = count; ! 728: ! 729: ! 730: ! 731: while (i-- > 0) ! 732: ! 733: *t++ = *f++; ! 734: ! 735: } ! 736: ! 737: ! 738: ! 739: #endif ! 740: ! 741: #endif ! 742: ! 743: ! 744: ! 745: #line 169 "bison.simple" ! 746: ! 747: int ! 748: ! 749: yyparse() ! 750: ! 751: { ! 752: ! 753: register int yystate; ! 754: ! 755: register int yyn; ! 756: ! 757: register short *yyssp; ! 758: ! 759: register YYSTYPE *yyvsp; ! 760: ! 761: int yyerrstatus; /* number of tokens to shift before error messages enabled */ ! 762: ! 763: int yychar1; /* lookahead token as an internal (translated) token number */ ! 764: ! 765: ! 766: ! 767: short yyssa[YYINITDEPTH]; /* the state stack */ ! 768: ! 769: YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ ! 770: ! 771: ! 772: ! 773: short *yyss = yyssa; /* refer to the stacks thru separate pointers */ ! 774: ! 775: YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ ! 776: ! 777: ! 778: ! 779: #ifdef YYLSP_NEEDED ! 780: ! 781: YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ ! 782: ! 783: YYLTYPE *yyls = yylsa; ! 784: ! 785: YYLTYPE *yylsp; ! 786: ! 787: ! 788: ! 789: #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) ! 790: ! 791: #else ! 792: ! 793: #define YYPOPSTACK (yyvsp--, yyssp--) ! 794: ! 795: #endif ! 796: ! 797: ! 798: ! 799: int yystacksize = YYINITDEPTH; ! 800: ! 801: ! 802: ! 803: #ifdef YYPURE ! 804: ! 805: int yychar; ! 806: ! 807: YYSTYPE yylval; ! 808: ! 809: int yynerrs; ! 810: ! 811: #ifdef YYLSP_NEEDED ! 812: ! 813: YYLTYPE yylloc; ! 814: ! 815: #endif ! 816: ! 817: #endif ! 818: ! 819: ! 820: ! 821: YYSTYPE yyval; /* the variable used to return */ ! 822: ! 823: /* semantic values from the action */ ! 824: ! 825: /* routines */ ! 826: ! 827: ! 828: ! 829: int yylen; ! 830: ! 831: ! 832: ! 833: #if YYDEBUG != 0 ! 834: ! 835: if (yydebug) ! 836: ! 837: fprintf(stderr, "Starting parse\n"); ! 838: ! 839: #endif ! 840: ! 841: ! 842: ! 843: yystate = 0; ! 844: ! 845: yyerrstatus = 0; ! 846: ! 847: yynerrs = 0; ! 848: ! 849: yychar = YYEMPTY; /* Cause a token to be read. */ ! 850: ! 851: ! 852: ! 853: /* Initialize stack pointers. ! 854: ! 855: Waste one element of value and location stack ! 856: ! 857: so that they stay on the same level as the state stack. ! 858: ! 859: The wasted elements are never initialized. */ ! 860: ! 861: ! 862: ! 863: yyssp = yyss - 1; ! 864: ! 865: yyvsp = yyvs; ! 866: ! 867: #ifdef YYLSP_NEEDED ! 868: ! 869: yylsp = yyls; ! 870: ! 871: #endif ! 872: ! 873: ! 874: ! 875: /* Push a new state, which is found in yystate . */ ! 876: ! 877: /* In all cases, when you get here, the value and location stacks ! 878: ! 879: have just been pushed. so pushing a state here evens the stacks. */ ! 880: ! 881: yynewstate: ! 882: ! 883: ! 884: ! 885: *++yyssp = yystate; ! 886: ! 887: ! 888: ! 889: if (yyssp >= yyss + yystacksize - 1) ! 890: ! 891: { ! 892: ! 893: /* Give user a chance to reallocate the stack */ ! 894: ! 895: /* Use copies of these so that the &'s don't force the real ones into memory. */ ! 896: ! 897: YYSTYPE *yyvs1 = yyvs; ! 898: ! 899: short *yyss1 = yyss; ! 900: ! 901: #ifdef YYLSP_NEEDED ! 902: ! 903: YYLTYPE *yyls1 = yyls; ! 904: ! 905: #endif ! 906: ! 907: ! 908: ! 909: /* Get the current used size of the three stacks, in elements. */ ! 910: ! 911: int size = yyssp - yyss + 1; ! 912: ! 913: ! 914: ! 915: #ifdef yyoverflow ! 916: ! 917: /* Each stack pointer address is followed by the size of ! 918: ! 919: the data in use in that stack, in bytes. */ ! 920: ! 921: yyoverflow("parser stack overflow", ! 922: ! 923: &yyss1, size * sizeof (*yyssp), ! 924: ! 925: &yyvs1, size * sizeof (*yyvsp), ! 926: ! 927: #ifdef YYLSP_NEEDED ! 928: ! 929: &yyls1, size * sizeof (*yylsp), ! 930: ! 931: #endif ! 932: ! 933: &yystacksize); ! 934: ! 935: ! 936: ! 937: yyss = yyss1; yyvs = yyvs1; ! 938: ! 939: #ifdef YYLSP_NEEDED ! 940: ! 941: yyls = yyls1; ! 942: ! 943: #endif ! 944: ! 945: #else /* no yyoverflow */ ! 946: ! 947: /* Extend the stack our own way. */ ! 948: ! 949: if (yystacksize >= YYMAXDEPTH) ! 950: ! 951: { ! 952: ! 953: yyerror("parser stack overflow"); ! 954: ! 955: return 2; ! 956: ! 957: } ! 958: ! 959: yystacksize *= 2; ! 960: ! 961: if (yystacksize > YYMAXDEPTH) ! 962: ! 963: yystacksize = YYMAXDEPTH; ! 964: ! 965: yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); ! 966: ! 967: __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); ! 968: ! 969: yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); ! 970: ! 971: __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp)); ! 972: ! 973: #ifdef YYLSP_NEEDED ! 974: ! 975: yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); ! 976: ! 977: __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp)); ! 978: ! 979: #endif ! 980: ! 981: #endif /* no yyoverflow */ ! 982: ! 983: ! 984: ! 985: yyssp = yyss + size - 1; ! 986: ! 987: yyvsp = yyvs + size - 1; ! 988: ! 989: #ifdef YYLSP_NEEDED ! 990: ! 991: yylsp = yyls + size - 1; ! 992: ! 993: #endif ! 994: ! 995: ! 996: ! 997: #if YYDEBUG != 0 ! 998: ! 999: if (yydebug) ! 1000: ! 1001: fprintf(stderr, "Stack size increased to %d\n", yystacksize); ! 1002: ! 1003: #endif ! 1004: ! 1005: ! 1006: ! 1007: if (yyssp >= yyss + yystacksize - 1) ! 1008: ! 1009: YYABORT; ! 1010: ! 1011: } ! 1012: ! 1013: ! 1014: ! 1015: #if YYDEBUG != 0 ! 1016: ! 1017: if (yydebug) ! 1018: ! 1019: fprintf(stderr, "Entering state %d\n", yystate); ! 1020: ! 1021: #endif ! 1022: ! 1023: ! 1024: ! 1025: goto yybackup; ! 1026: ! 1027: yybackup: ! 1028: ! 1029: ! 1030: ! 1031: /* Do appropriate processing given the current state. */ ! 1032: ! 1033: /* Read a lookahead token if we need one and don't already have one. */ ! 1034: ! 1035: /* yyresume: */ ! 1036: ! 1037: ! 1038: ! 1039: /* First try to decide what to do without reference to lookahead token. */ ! 1040: ! 1041: ! 1042: ! 1043: yyn = yypact[yystate]; ! 1044: ! 1045: if (yyn == YYFLAG) ! 1046: ! 1047: goto yydefault; ! 1048: ! 1049: ! 1050: ! 1051: /* Not known => get a lookahead token if don't already have one. */ ! 1052: ! 1053: ! 1054: ! 1055: /* yychar is either YYEMPTY or YYEOF ! 1056: ! 1057: or a valid token in external form. */ ! 1058: ! 1059: ! 1060: ! 1061: if (yychar == YYEMPTY) ! 1062: ! 1063: { ! 1064: ! 1065: #if YYDEBUG != 0 ! 1066: ! 1067: if (yydebug) ! 1068: ! 1069: fprintf(stderr, "Reading a token: "); ! 1070: ! 1071: #endif ! 1072: ! 1073: yychar = YYLEX; ! 1074: ! 1075: } ! 1076: ! 1077: ! 1078: ! 1079: /* Convert token to internal form (in yychar1) for indexing tables with */ ! 1080: ! 1081: ! 1082: ! 1083: if (yychar <= 0) /* This means end of input. */ ! 1084: ! 1085: { ! 1086: ! 1087: yychar1 = 0; ! 1088: ! 1089: yychar = YYEOF; /* Don't call YYLEX any more */ ! 1090: ! 1091: ! 1092: ! 1093: #if YYDEBUG != 0 ! 1094: ! 1095: if (yydebug) ! 1096: ! 1097: fprintf(stderr, "Now at end of input.\n"); ! 1098: ! 1099: #endif ! 1100: ! 1101: } ! 1102: ! 1103: else ! 1104: ! 1105: { ! 1106: ! 1107: yychar1 = YYTRANSLATE(yychar); ! 1108: ! 1109: ! 1110: ! 1111: #if YYDEBUG != 0 ! 1112: ! 1113: if (yydebug) ! 1114: ! 1115: { ! 1116: ! 1117: fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); ! 1118: ! 1119: /* Give the individual parser a way to print the precise meaning ! 1120: ! 1121: of a token, for further debugging info. */ ! 1122: ! 1123: #ifdef YYPRINT ! 1124: ! 1125: YYPRINT (stderr, yychar, yylval); ! 1126: ! 1127: #endif ! 1128: ! 1129: fprintf (stderr, ")\n"); ! 1130: ! 1131: } ! 1132: ! 1133: #endif ! 1134: ! 1135: } ! 1136: ! 1137: ! 1138: ! 1139: yyn += yychar1; ! 1140: ! 1141: if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) ! 1142: ! 1143: goto yydefault; ! 1144: ! 1145: ! 1146: ! 1147: yyn = yytable[yyn]; ! 1148: ! 1149: ! 1150: ! 1151: /* yyn is what to do for this token type in this state. ! 1152: ! 1153: Negative => reduce, -yyn is rule number. ! 1154: ! 1155: Positive => shift, yyn is new state. ! 1156: ! 1157: New state is final state => don't bother to shift, ! 1158: ! 1159: just return success. ! 1160: ! 1161: 0, or most negative number => error. */ ! 1162: ! 1163: ! 1164: ! 1165: if (yyn < 0) ! 1166: ! 1167: { ! 1168: ! 1169: if (yyn == YYFLAG) ! 1170: ! 1171: goto yyerrlab; ! 1172: ! 1173: yyn = -yyn; ! 1174: ! 1175: goto yyreduce; ! 1176: ! 1177: } ! 1178: ! 1179: else if (yyn == 0) ! 1180: ! 1181: goto yyerrlab; ! 1182: ! 1183: ! 1184: ! 1185: if (yyn == YYFINAL) ! 1186: ! 1187: YYACCEPT; ! 1188: ! 1189: ! 1190: ! 1191: /* Shift the lookahead token. */ ! 1192: ! 1193: ! 1194: ! 1195: #if YYDEBUG != 0 ! 1196: ! 1197: if (yydebug) ! 1198: ! 1199: fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); ! 1200: ! 1201: #endif ! 1202: ! 1203: ! 1204: ! 1205: /* Discard the token being shifted unless it is eof. */ ! 1206: ! 1207: if (yychar != YYEOF) ! 1208: ! 1209: yychar = YYEMPTY; ! 1210: ! 1211: ! 1212: ! 1213: *++yyvsp = yylval; ! 1214: ! 1215: #ifdef YYLSP_NEEDED ! 1216: ! 1217: *++yylsp = yylloc; ! 1218: ! 1219: #endif ! 1220: ! 1221: ! 1222: ! 1223: /* count tokens shifted since error; after three, turn off error status. */ ! 1224: ! 1225: if (yyerrstatus) yyerrstatus--; ! 1226: ! 1227: ! 1228: ! 1229: yystate = yyn; ! 1230: ! 1231: goto yynewstate; ! 1232: ! 1233: ! 1234: ! 1235: /* Do the default action for the current state. */ ! 1236: ! 1237: yydefault: ! 1238: ! 1239: ! 1240: ! 1241: yyn = yydefact[yystate]; ! 1242: ! 1243: if (yyn == 0) ! 1244: ! 1245: goto yyerrlab; ! 1246: ! 1247: ! 1248: ! 1249: /* Do a reduction. yyn is the number of a rule to reduce with. */ ! 1250: ! 1251: yyreduce: ! 1252: ! 1253: yylen = yyr2[yyn]; ! 1254: ! 1255: yyval = yyvsp[1-yylen]; /* implement default value of the action */ ! 1256: ! 1257: ! 1258: ! 1259: #if YYDEBUG != 0 ! 1260: ! 1261: if (yydebug) ! 1262: ! 1263: { ! 1264: ! 1265: int i; ! 1266: ! 1267: ! 1268: ! 1269: fprintf (stderr, "Reducing via rule %d (line %d), ", ! 1270: ! 1271: yyn, yyrline[yyn]); ! 1272: ! 1273: ! 1274: ! 1275: /* Print the symbols being reduced, and their result. */ ! 1276: ! 1277: for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) ! 1278: ! 1279: fprintf (stderr, "%s ", yytname[yyrhs[i]]); ! 1280: ! 1281: fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); ! 1282: ! 1283: } ! 1284: ! 1285: #endif ! 1286: ! 1287: ! 1288: ! 1289: ! 1290: ! 1291: switch (yyn) { ! 1292: ! 1293: ! 1294: ! 1295: case 3: ! 1296: ! 1297: #line 26 "asm.y" ! 1298: ! 1299: { emit(yyvsp[0]); ; ! 1300: ! 1301: break;} ! 1302: ! 1303: case 4: ! 1304: ! 1305: #line 29 "asm.y" ! 1306: ! 1307: { emit(yyvsp[-1]); emit(yyvsp[0]); ; ! 1308: ! 1309: break;} ! 1310: ! 1311: case 5: ! 1312: ! 1313: #line 30 "asm.y" ! 1314: ! 1315: { emit(yyvsp[-1]); emit(yyvsp[0]); ; ! 1316: ! 1317: break;} ! 1318: ! 1319: case 6: ! 1320: ! 1321: #line 31 "asm.y" ! 1322: ! 1323: { emit(yyvsp[-2]); emit(yyvsp[-1]); ! 1324: ! 1325: emit(yyvsp[0]); ; ! 1326: ! 1327: break;} ! 1328: ! 1329: case 7: ! 1330: ! 1331: #line 33 "asm.y" ! 1332: ! 1333: { if (!hidecnt) do_include(yyvsp[-1]); free(yyvsp[-1]); ; ! 1334: ! 1335: break;} ! 1336: ! 1337: case 8: ! 1338: ! 1339: #line 34 "asm.y" ! 1340: ! 1341: { if (!hidecnt) do_include(yyvsp[-1]); free(yyvsp[-1]); ; ! 1342: ! 1343: break;} ! 1344: ! 1345: case 9: ! 1346: ! 1347: #line 35 "asm.y" ! 1348: ! 1349: { ! 1350: ! 1351: if (!hidecnt) do_define(yyvsp[-3], yyvsp[-1]); free(yyvsp[-3]); free(yyvsp[-1]); ; ! 1352: ! 1353: break;} ! 1354: ! 1355: case 10: ! 1356: ! 1357: #line 37 "asm.y" ! 1358: ! 1359: { ! 1360: ! 1361: if (!hidecnt) do_define(yyvsp[-3], yyvsp[-1]); free(yyvsp[-3]); free(yyvsp[-1]); ; ! 1362: ! 1363: break;} ! 1364: ! 1365: case 11: ! 1366: ! 1367: #line 39 "asm.y" ! 1368: ! 1369: { do_ifdef(yyvsp[-1]); free(yyvsp[-1]); ; ! 1370: ! 1371: break;} ! 1372: ! 1373: case 12: ! 1374: ! 1375: #line 40 "asm.y" ! 1376: ! 1377: { do_ifndef(yyvsp[-1]); free(yyvsp[-1]); ; ! 1378: ! 1379: break;} ! 1380: ! 1381: case 13: ! 1382: ! 1383: #line 41 "asm.y" ! 1384: ! 1385: { do_else(); ; ! 1386: ! 1387: break;} ! 1388: ! 1389: case 14: ! 1390: ! 1391: #line 42 "asm.y" ! 1392: ! 1393: { do_endif(); ; ! 1394: ! 1395: break;} ! 1396: ! 1397: case 15: ! 1398: ! 1399: #line 45 "asm.y" ! 1400: ! 1401: { yyval = do_ops("", yyvsp[0], "", ""); free(yyvsp[0]); ; ! 1402: ! 1403: break;} ! 1404: ! 1405: case 16: ! 1406: ! 1407: #line 47 "asm.y" ! 1408: ! 1409: { yyval = do_ops("", yyvsp[-2], yyvsp[-1], yyvsp[0]); ! 1410: ! 1411: free(yyvsp[-2]); free(yyvsp[-1]); free(yyvsp[0]); ; ! 1412: ! 1413: break;} ! 1414: ! 1415: case 17: ! 1416: ! 1417: #line 49 "asm.y" ! 1418: ! 1419: { yyval = do_ops(yyvsp[-2], yyvsp[0], "", ""); free(yyvsp[-2]); free(yyvsp[0]); ; ! 1420: ! 1421: break;} ! 1422: ! 1423: case 18: ! 1424: ! 1425: #line 51 "asm.y" ! 1426: ! 1427: { yyval = do_ops(yyvsp[-4], yyvsp[-2], yyvsp[-1], yyvsp[0]); ! 1428: ! 1429: free(yyvsp[-4]); free(yyvsp[-2]); free(yyvsp[-1]); free(yyvsp[0]);; ! 1430: ! 1431: break;} ! 1432: ! 1433: case 19: ! 1434: ! 1435: #line 55 "asm.y" ! 1436: ! 1437: { yyval = yyvsp[0]; ; ! 1438: ! 1439: break;} ! 1440: ! 1441: case 20: ! 1442: ! 1443: #line 56 "asm.y" ! 1444: ! 1445: { yyval = concat3(yyvsp[-2], ",", yyvsp[0]); ! 1446: ! 1447: free(yyvsp[-2]); free(yyvsp[0]); ; ! 1448: ! 1449: break;} ! 1450: ! 1451: case 21: ! 1452: ! 1453: #line 60 "asm.y" ! 1454: ! 1455: { yyval = wordlookup(yyvsp[0]); free(yyvsp[0]); ; ! 1456: ! 1457: break;} ! 1458: ! 1459: case 22: ! 1460: ! 1461: #line 63 "asm.y" ! 1462: ! 1463: { yyval = concat(yyvsp[-1], ":"); free(yyvsp[-1]); ; ! 1464: ! 1465: break;} ! 1466: ! 1467: case 23: ! 1468: ! 1469: #line 65 "asm.y" ! 1470: ! 1471: {yyval = yyvsp[0]; ; ! 1472: ! 1473: break;} ! 1474: ! 1475: case 24: ! 1476: ! 1477: #line 66 "asm.y" ! 1478: ! 1479: {yyval = immediate(yyvsp[0]); free(yyvsp[0]); ; ! 1480: ! 1481: break;} ! 1482: ! 1483: case 25: ! 1484: ! 1485: #line 67 "asm.y" ! 1486: ! 1487: {yyval = indirect(yyvsp[-1]); free(yyvsp[-1]); ; ! 1488: ! 1489: break;} ! 1490: ! 1491: case 26: ! 1492: ! 1493: #line 68 "asm.y" ! 1494: ! 1495: {yyval = postinc(yyvsp[-2]); free(yyvsp[-2]); ; ! 1496: ! 1497: break;} ! 1498: ! 1499: case 27: ! 1500: ! 1501: #line 69 "asm.y" ! 1502: ! 1503: {yyval = predec(yyvsp[-1]); free(yyvsp[-1]); ; ! 1504: ! 1505: break;} ! 1506: ! 1507: case 28: ! 1508: ! 1509: #line 70 "asm.y" ! 1510: ! 1511: {yyval = indexed(yyvsp[-3], yyvsp[-1]); free(yyvsp[-3]); free(yyvsp[-1]); ; ! 1512: ! 1513: break;} ! 1514: ! 1515: case 29: ! 1516: ! 1517: #line 71 "asm.y" ! 1518: ! 1519: {yyval = sizedop(yyvsp[-2], yyvsp[0]); free(yyvsp[-2]); free(yyvsp[0]); ; ! 1520: ! 1521: break;} ! 1522: ! 1523: case 30: ! 1524: ! 1525: #line 72 "asm.y" ! 1526: ! 1527: {yyval = twoindex(yyvsp[-5], yyvsp[-3], yyvsp[-1]); ! 1528: ! 1529: free(yyvsp[-5]); free(yyvsp[-3]); free(yyvsp[-1]); ; ! 1530: ! 1531: break;} ! 1532: ! 1533: case 31: ! 1534: ! 1535: #line 74 "asm.y" ! 1536: ! 1537: {yyval = bitfield(yyvsp[-5], yyvsp[-3], yyvsp[-1]); ! 1538: ! 1539: free(yyvsp[-5]); free(yyvsp[-3]); free(yyvsp[-1]); ; ! 1540: ! 1541: break;} ! 1542: ! 1543: case 32: ! 1544: ! 1545: #line 78 "asm.y" ! 1546: ! 1547: { yyval = yyvsp[0]; ; ! 1548: ! 1549: break;} ! 1550: ! 1551: case 33: ! 1552: ! 1553: #line 79 "asm.y" ! 1554: ! 1555: { yyval = concat3(yyvsp[-2], yyvsp[-1], yyvsp[0]); free(yyvsp[-2]); free(yyvsp[-1]); free(yyvsp[0]); ; ! 1556: ! 1557: break;} ! 1558: ! 1559: case 34: ! 1560: ! 1561: #line 80 "asm.y" ! 1562: ! 1563: { yyval = concat("-", yyvsp[0]); free(yyvsp[0]); ; ! 1564: ! 1565: break;} ! 1566: ! 1567: case 35: ! 1568: ! 1569: #line 82 "asm.y" ! 1570: ! 1571: {yyval = wordlookup(yyvsp[0]); free(yyvsp[0]); ; ! 1572: ! 1573: break;} ! 1574: ! 1575: case 36: ! 1576: ! 1577: #line 83 "asm.y" ! 1578: ! 1579: {yyval = hexop(yyvsp[0]); free(yyvsp[0]);; ! 1580: ! 1581: break;} ! 1582: ! 1583: case 37: ! 1584: ! 1585: #line 86 "asm.y" ! 1586: ! 1587: { yyval = strdup("+"); ; ! 1588: ! 1589: break;} ! 1590: ! 1591: case 38: ! 1592: ! 1593: #line 87 "asm.y" ! 1594: ! 1595: { yyval = strdup("-"); ; ! 1596: ! 1597: break;} ! 1598: ! 1599: case 39: ! 1600: ! 1601: #line 88 "asm.y" ! 1602: ! 1603: { yyval = strdup("*"); ; ! 1604: ! 1605: break;} ! 1606: ! 1607: case 40: ! 1608: ! 1609: #line 89 "asm.y" ! 1610: ! 1611: { yyval = strdup("/"); ; ! 1612: ! 1613: break;} ! 1614: ! 1615: } ! 1616: ! 1617: /* the action file gets copied in in place of this dollarsign */ ! 1618: ! 1619: #line 442 "bison.simple" ! 1620: ! 1621: ! 1622: ! 1623: yyvsp -= yylen; ! 1624: ! 1625: yyssp -= yylen; ! 1626: ! 1627: #ifdef YYLSP_NEEDED ! 1628: ! 1629: yylsp -= yylen; ! 1630: ! 1631: #endif ! 1632: ! 1633: ! 1634: ! 1635: #if YYDEBUG != 0 ! 1636: ! 1637: if (yydebug) ! 1638: ! 1639: { ! 1640: ! 1641: short *ssp1 = yyss - 1; ! 1642: ! 1643: fprintf (stderr, "state stack now"); ! 1644: ! 1645: while (ssp1 != yyssp) ! 1646: ! 1647: fprintf (stderr, " %d", *++ssp1); ! 1648: ! 1649: fprintf (stderr, "\n"); ! 1650: ! 1651: } ! 1652: ! 1653: #endif ! 1654: ! 1655: ! 1656: ! 1657: *++yyvsp = yyval; ! 1658: ! 1659: ! 1660: ! 1661: #ifdef YYLSP_NEEDED ! 1662: ! 1663: yylsp++; ! 1664: ! 1665: if (yylen == 0) ! 1666: ! 1667: { ! 1668: ! 1669: yylsp->first_line = yylloc.first_line; ! 1670: ! 1671: yylsp->first_column = yylloc.first_column; ! 1672: ! 1673: yylsp->last_line = (yylsp-1)->last_line; ! 1674: ! 1675: yylsp->last_column = (yylsp-1)->last_column; ! 1676: ! 1677: yylsp->text = 0; ! 1678: ! 1679: } ! 1680: ! 1681: else ! 1682: ! 1683: { ! 1684: ! 1685: yylsp->last_line = (yylsp+yylen-1)->last_line; ! 1686: ! 1687: yylsp->last_column = (yylsp+yylen-1)->last_column; ! 1688: ! 1689: } ! 1690: ! 1691: #endif ! 1692: ! 1693: ! 1694: ! 1695: /* Now "shift" the result of the reduction. ! 1696: ! 1697: Determine what state that goes to, ! 1698: ! 1699: based on the state we popped back to ! 1700: ! 1701: and the rule number reduced by. */ ! 1702: ! 1703: ! 1704: ! 1705: yyn = yyr1[yyn]; ! 1706: ! 1707: ! 1708: ! 1709: yystate = yypgoto[yyn - YYNTBASE] + *yyssp; ! 1710: ! 1711: if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) ! 1712: ! 1713: yystate = yytable[yystate]; ! 1714: ! 1715: else ! 1716: ! 1717: yystate = yydefgoto[yyn - YYNTBASE]; ! 1718: ! 1719: ! 1720: ! 1721: goto yynewstate; ! 1722: ! 1723: ! 1724: ! 1725: yyerrlab: /* here on detecting error */ ! 1726: ! 1727: ! 1728: ! 1729: if (! yyerrstatus) ! 1730: ! 1731: /* If not already recovering from an error, report this error. */ ! 1732: ! 1733: { ! 1734: ! 1735: ++yynerrs; ! 1736: ! 1737: ! 1738: ! 1739: #ifdef YYERROR_VERBOSE ! 1740: ! 1741: yyn = yypact[yystate]; ! 1742: ! 1743: ! 1744: ! 1745: if (yyn > YYFLAG && yyn < YYLAST) ! 1746: ! 1747: { ! 1748: ! 1749: int size = 0; ! 1750: ! 1751: char *msg; ! 1752: ! 1753: int x, count; ! 1754: ! 1755: ! 1756: ! 1757: count = 0; ! 1758: ! 1759: for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) ! 1760: ! 1761: if (yycheck[x + yyn] == x) ! 1762: ! 1763: size += strlen(yytname[x]) + 15, count++; ! 1764: ! 1765: msg = (char *) malloc(size + 15); ! 1766: ! 1767: if (msg != 0) ! 1768: ! 1769: { ! 1770: ! 1771: strcpy(msg, "parse error"); ! 1772: ! 1773: ! 1774: ! 1775: if (count < 5) ! 1776: ! 1777: { ! 1778: ! 1779: count = 0; ! 1780: ! 1781: for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++) ! 1782: ! 1783: if (yycheck[x + yyn] == x) ! 1784: ! 1785: { ! 1786: ! 1787: strcat(msg, count == 0 ? ", expecting `" : " or `"); ! 1788: ! 1789: strcat(msg, yytname[x]); ! 1790: ! 1791: strcat(msg, "'"); ! 1792: ! 1793: count++; ! 1794: ! 1795: } ! 1796: ! 1797: } ! 1798: ! 1799: yyerror(msg); ! 1800: ! 1801: free(msg); ! 1802: ! 1803: } ! 1804: ! 1805: else ! 1806: ! 1807: yyerror ("parse error; also virtual memory exceeded"); ! 1808: ! 1809: } ! 1810: ! 1811: else ! 1812: ! 1813: #endif /* YYERROR_VERBOSE */ ! 1814: ! 1815: yyerror("parse error"); ! 1816: ! 1817: } ! 1818: ! 1819: ! 1820: ! 1821: goto yyerrlab1; ! 1822: ! 1823: yyerrlab1: /* here on error raised explicitly by an action */ ! 1824: ! 1825: ! 1826: ! 1827: if (yyerrstatus == 3) ! 1828: ! 1829: { ! 1830: ! 1831: /* if just tried and failed to reuse lookahead token after an error, discard it. */ ! 1832: ! 1833: ! 1834: ! 1835: /* return failure if at end of input */ ! 1836: ! 1837: if (yychar == YYEOF) ! 1838: ! 1839: YYABORT; ! 1840: ! 1841: ! 1842: ! 1843: #if YYDEBUG != 0 ! 1844: ! 1845: if (yydebug) ! 1846: ! 1847: fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); ! 1848: ! 1849: #endif ! 1850: ! 1851: ! 1852: ! 1853: yychar = YYEMPTY; ! 1854: ! 1855: } ! 1856: ! 1857: ! 1858: ! 1859: /* Else will try to reuse lookahead token ! 1860: ! 1861: after shifting the error token. */ ! 1862: ! 1863: ! 1864: ! 1865: yyerrstatus = 3; /* Each real token shifted decrements this */ ! 1866: ! 1867: ! 1868: ! 1869: goto yyerrhandle; ! 1870: ! 1871: ! 1872: ! 1873: yyerrdefault: /* current state does not do anything special for the error token. */ ! 1874: ! 1875: ! 1876: ! 1877: #if 0 ! 1878: ! 1879: /* This is wrong; only states that explicitly want error tokens ! 1880: ! 1881: should shift them. */ ! 1882: ! 1883: yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ ! 1884: ! 1885: if (yyn) goto yydefault; ! 1886: ! 1887: #endif ! 1888: ! 1889: ! 1890: ! 1891: yyerrpop: /* pop the current state because it cannot handle the error token */ ! 1892: ! 1893: ! 1894: ! 1895: if (yyssp == yyss) YYABORT; ! 1896: ! 1897: yyvsp--; ! 1898: ! 1899: yystate = *--yyssp; ! 1900: ! 1901: #ifdef YYLSP_NEEDED ! 1902: ! 1903: yylsp--; ! 1904: ! 1905: #endif ! 1906: ! 1907: ! 1908: ! 1909: #if YYDEBUG != 0 ! 1910: ! 1911: if (yydebug) ! 1912: ! 1913: { ! 1914: ! 1915: short *ssp1 = yyss - 1; ! 1916: ! 1917: fprintf (stderr, "Error: state stack now"); ! 1918: ! 1919: while (ssp1 != yyssp) ! 1920: ! 1921: fprintf (stderr, " %d", *++ssp1); ! 1922: ! 1923: fprintf (stderr, "\n"); ! 1924: ! 1925: } ! 1926: ! 1927: #endif ! 1928: ! 1929: ! 1930: ! 1931: yyerrhandle: ! 1932: ! 1933: ! 1934: ! 1935: yyn = yypact[yystate]; ! 1936: ! 1937: if (yyn == YYFLAG) ! 1938: ! 1939: goto yyerrdefault; ! 1940: ! 1941: ! 1942: ! 1943: yyn += YYTERROR; ! 1944: ! 1945: if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) ! 1946: ! 1947: goto yyerrdefault; ! 1948: ! 1949: ! 1950: ! 1951: yyn = yytable[yyn]; ! 1952: ! 1953: if (yyn < 0) ! 1954: ! 1955: { ! 1956: ! 1957: if (yyn == YYFLAG) ! 1958: ! 1959: goto yyerrpop; ! 1960: ! 1961: yyn = -yyn; ! 1962: ! 1963: goto yyreduce; ! 1964: ! 1965: } ! 1966: ! 1967: else if (yyn == 0) ! 1968: ! 1969: goto yyerrpop; ! 1970: ! 1971: ! 1972: ! 1973: if (yyn == YYFINAL) ! 1974: ! 1975: YYACCEPT; ! 1976: ! 1977: ! 1978: ! 1979: #if YYDEBUG != 0 ! 1980: ! 1981: if (yydebug) ! 1982: ! 1983: fprintf(stderr, "Shifting error token, "); ! 1984: ! 1985: #endif ! 1986: ! 1987: ! 1988: ! 1989: *++yyvsp = yylval; ! 1990: ! 1991: #ifdef YYLSP_NEEDED ! 1992: ! 1993: *++yylsp = yylloc; ! 1994: ! 1995: #endif ! 1996: ! 1997: ! 1998: ! 1999: yystate = yyn; ! 2000: ! 2001: goto yynewstate; ! 2002: ! 2003: } ! 2004: ! 2005: #line 91 "asm.y" ! 2006: ! 2007: ! 2008: ! 2009: #include <setjmp.h> ! 2010: ! 2011: ! 2012: ! 2013: jmp_buf start; ! 2014: ! 2015: ! 2016: ! 2017: #ifdef NATIVEATARI ! 2018: ! 2019: #define STACK 32*1024L; ! 2020: ! 2021: #ifdef LATTICE ! 2022: ! 2023: long _STACK = STACK; ! 2024: ! 2025: #endif ! 2026: ! 2027: #ifdef __GNUC__ ! 2028: ! 2029: long _stksize = STACK; ! 2030: ! 2031: #endif ! 2032: ! 2033: ! 2034: ! 2035: static void ! 2036: ! 2037: hit_return() ! 2038: ! 2039: { ! 2040: ! 2041: printf("Hit return to continue\n"); ! 2042: ! 2043: fflush(stdout); ! 2044: ! 2045: getchar(); ! 2046: ! 2047: } ! 2048: ! 2049: #endif ! 2050: ! 2051: ! 2052: ! 2053: void usage() ! 2054: ! 2055: { ! 2056: ! 2057: fprintf(stderr, "Usage: asmtrans [-gas][-asm][-o outfile] infile\n"); ! 2058: ! 2059: exit(2); ! 2060: ! 2061: } ! 2062: ! 2063: ! 2064: ! 2065: int errors = 0; ! 2066: ! 2067: ! 2068: ! 2069: void ! 2070: ! 2071: do_include(file) ! 2072: ! 2073: char *file; ! 2074: ! 2075: { ! 2076: ! 2077: jmp_buf save; ! 2078: ! 2079: FILE *oldin, *f; ! 2080: ! 2081: ! 2082: ! 2083: f = fopen(file, "r"); ! 2084: ! 2085: if (!f) { ! 2086: ! 2087: perror(file); ! 2088: ! 2089: return; ! 2090: ! 2091: } ! 2092: ! 2093: bcopy(start, save, sizeof(jmp_buf)); ! 2094: ! 2095: oldin = infile; ! 2096: ! 2097: infile = f; ! 2098: ! 2099: setjmp(start); ! 2100: ! 2101: yyparse(); ! 2102: ! 2103: fclose(f); ! 2104: ! 2105: infile = oldin; ! 2106: ! 2107: bcopy(save, start, sizeof(jmp_buf)); ! 2108: ! 2109: longjmp(start,1); ! 2110: ! 2111: } ! 2112: ! 2113: ! 2114: ! 2115: /* set up initial definitions based on syntax type */ ! 2116: ! 2117: ! 2118: ! 2119: void ! 2120: ! 2121: do_initial_defs() ! 2122: ! 2123: { ! 2124: ! 2125: if (syntax == GAS) { ! 2126: ! 2127: do_define("fpiar", "fpi"); ! 2128: ! 2129: do_define("XREF", ".globl"); ! 2130: ! 2131: do_define("XDEF", ".globl"); ! 2132: ! 2133: do_define("TEXT", ".text"); ! 2134: ! 2135: do_define("DATA", ".data"); ! 2136: ! 2137: /* gas doesn't have a .bss directive */ ! 2138: ! 2139: do_define("BSS", ".data"); ! 2140: ! 2141: do_define("END", "| END"); ! 2142: ! 2143: do_define("dc.l", ".long"); ! 2144: ! 2145: do_define("dc.w", ".word"); ! 2146: ! 2147: do_define("dc.b", ".byte"); ! 2148: ! 2149: } else if (syntax == ASM) { ! 2150: ! 2151: do_define("TEXT", "SECTION TEXT"); ! 2152: ! 2153: do_define("DATA", "SECTION DATA"); ! 2154: ! 2155: do_define("BSS", "SECTION BSS"); ! 2156: ! 2157: } ! 2158: ! 2159: } ! 2160: ! 2161: ! 2162: ! 2163: int ! 2164: ! 2165: main (argc, argv) ! 2166: ! 2167: int argc; char **argv; ! 2168: ! 2169: { ! 2170: ! 2171: FILE *f; ! 2172: ! 2173: #ifdef NATIVEATARI ! 2174: ! 2175: if (!argv[0] || !argv[0][0]) /* run from desktop? */ ! 2176: ! 2177: atexit(hit_return); ! 2178: ! 2179: #endif ! 2180: ! 2181: argv++; ! 2182: ! 2183: outfile = stdout; ! 2184: ! 2185: ! 2186: ! 2187: while (*argv) { ! 2188: ! 2189: if (!strcmp(*argv, "-o")) { ! 2190: ! 2191: argv++; ! 2192: ! 2193: if (*argv == 0) { ! 2194: ! 2195: fprintf(stderr, "missing argument to -o\n"); ! 2196: ! 2197: usage(); ! 2198: ! 2199: } ! 2200: ! 2201: f = fopen(*argv, "w"); ! 2202: ! 2203: if (!f) ! 2204: ! 2205: perror(*argv); ! 2206: ! 2207: else ! 2208: ! 2209: outfile = f; ! 2210: ! 2211: argv++; ! 2212: ! 2213: } else if (!strcmp(*argv, "-gas")) { ! 2214: ! 2215: argv++; ! 2216: ! 2217: syntax = GAS; ! 2218: ! 2219: } else if (!strcmp(*argv, "-asm")) { ! 2220: ! 2221: argv++; ! 2222: ! 2223: syntax = ASM; ! 2224: ! 2225: } else if (!strcmp(*argv, "-purec")) { ! 2226: ! 2227: argv++; ! 2228: ! 2229: syntax = PUREC; ! 2230: ! 2231: } else if (!strncmp(*argv, "-D", 2)) { ! 2232: ! 2233: char *word, *defn; ! 2234: ! 2235: word = *argv+2; ! 2236: ! 2237: defn = index(word,'='); ! 2238: ! 2239: if (defn) ! 2240: ! 2241: *defn++ = '\0'; ! 2242: ! 2243: else ! 2244: ! 2245: defn = "1"; ! 2246: ! 2247: if (*word) do_define(word,defn); ! 2248: ! 2249: argv++; ! 2250: ! 2251: } else if (!strcmp(*argv, "--")) { ! 2252: ! 2253: argv++; ! 2254: ! 2255: break; ! 2256: ! 2257: } else { ! 2258: ! 2259: if (**argv == '-') { ! 2260: ! 2261: fprintf(stderr, "unknown option: %s\n", ! 2262: ! 2263: *argv); ! 2264: ! 2265: usage(); ! 2266: ! 2267: } ! 2268: ! 2269: break; ! 2270: ! 2271: } ! 2272: ! 2273: } ! 2274: ! 2275: ! 2276: ! 2277: do_initial_defs(); ! 2278: ! 2279: ! 2280: ! 2281: if (*argv == 0) { ! 2282: ! 2283: setjmp(start); ! 2284: ! 2285: infile = stdin; ! 2286: ! 2287: yyparse(); ! 2288: ! 2289: } else { ! 2290: ! 2291: while(*argv) { ! 2292: ! 2293: if (!(f = fopen(*argv, "r"))) ! 2294: ! 2295: perror(*argv); ! 2296: ! 2297: else { ! 2298: ! 2299: infile = f; ! 2300: ! 2301: setjmp(start); ! 2302: ! 2303: yyparse(); ! 2304: ! 2305: fclose(f); ! 2306: ! 2307: } ! 2308: ! 2309: argv++; ! 2310: ! 2311: } ! 2312: ! 2313: } ! 2314: ! 2315: ! 2316: ! 2317: if (ifstkptr != 0) { ! 2318: ! 2319: fputs("%ifdef without matching %endif\n", stderr); ! 2320: ! 2321: errors++; ! 2322: ! 2323: } ! 2324: ! 2325: return errors; ! 2326: ! 2327: } ! 2328: ! 2329: ! 2330: ! 2331: void ! 2332: ! 2333: yyerror (s) /* Called by yyparse on error */ ! 2334: ! 2335: char *s; ! 2336: ! 2337: { ! 2338: ! 2339: errors++; ! 2340: ! 2341: printf("%s\n", s); ! 2342: ! 2343: longjmp(start, 1); ! 2344: ! 2345: } ! 2346: ! 2347: ! 2348: ! 2349: void dbgmsg(s) char *s; ! 2350: ! 2351: { ! 2352: ! 2353: fprintf(stderr, "%s\n", s); ! 2354: ! 2355: } ! 2356:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.