📄 as.c
字号:
"ARPLOP","ESC","INT","RET","XCHG","TEST","MOV","IMUL","ENTER","EXTOP","EXTOP1","ST",};char *yyrule[] = {"$accept : program","program :","program : program IDENT ':'","program : program NUMBER ':'","program : program CODE1","program : program CODE2","program : program CODE4","program : program operation ';'","program : program operation '\\n'","program : program '#' NUMBER STRING '\\n'","program : program error '\\n'","operation :","operation : IDENT '=' expr","operation : LIST","operation : SECTION IDENT","operation : COMMON IDENT ',' absexp","operation : BASE absexp","operation : ASSERT expr","$$1 :","operation : SYMB STRING ',' expr $$1 optabs2 optabs2","operation : SYMD STRING ',' absexp ',' absexp","operation : LINE optabs1","operation : FILe STRING","operation : EXTERN externlist","operation : ALIGN optabs1","operation : SPACE absexp","operation : DATA datalist","operation : ASCII STRING","externlist : IDENT","externlist : externlist ',' IDENT","datalist : expr","datalist : datalist ',' expr","expr : error","expr : NUMBER","expr : id_fb","expr : STRING","expr : '[' expr ']'","expr : expr OP_OO expr","expr : expr OP_AA expr","expr : expr '|' expr","expr : expr '^' expr","expr : expr '&' expr","expr : expr OP_EQ expr","expr : expr OP_NE expr","expr : expr '<' expr","expr : expr '>' expr","expr : expr OP_LE expr","expr : expr OP_GE expr","expr : expr OP_RR expr","expr : expr OP_LL expr","expr : expr '+' expr","expr : expr '-' expr","expr : expr '*' expr","expr : expr '/' expr","expr : expr '%' expr","expr : '+' expr","expr : '-' expr","expr : '~' expr","expr : DOT","id_fb : IDENT","id_fb : FBSYM","absexp : expr","optabs1 :","optabs1 : absexp","optabs2 :","optabs2 : ',' absexp","operation : prefix oper","prefix :","prefix : prefix PREFIX","oper : NOOP_1","oper : NOOP_2","oper : JOP expr","oper : PUSHOP ea_1","oper : IOOP expr","oper : IOOP R16","oper : ADDOP ea_ea","oper : ROLOP ea_ea","oper : INCOP ea_1","oper : IMUL ea_ea","oper : IMUL ea_1","oper : NOTOP ea_1","oper : CALLOP ea_1","oper : CALFOP expr ':' expr","oper : CALFOP mem","oper : ENTER absexp ',' absexp","oper : LEAOP R16 ',' mem","oper : ARPLOP mem ',' R16","oper : EXTOP R16 ',' ea_2","oper : EXTOP1 ea_1","oper : ESC absexp ',' mem","oper : INT absexp","oper : RET","oper : RET expr","oper : XCHG ea_ea","oper : TEST ea_ea","oper : MOV ea_ea","st_i : ST '(' absexp ')'","mem : '(' expr ')'","mem : bases","mem : expr bases","bases : '(' R16 ')'","bases : '(' R16 ')' '(' R16 ')'","ea_2 : mem","ea_2 : R8","ea_2 : R16","ea_2 : RSEG","ea_2 : expr","ea_1 : ea_2","ea_ea : ea_1 ',' ea_2",};#endif#define yyclearin (yychar=(-1))#define yyerrok (yyerrflag=0)#ifdef YYSTACKSIZE#ifndef YYMAXDEPTH#define YYMAXDEPTH YYSTACKSIZE#endif#else#ifdef YYMAXDEPTH#define YYSTACKSIZE YYMAXDEPTH#else#define YYSTACKSIZE 200#define YYMAXDEPTH 200#endif#endif#if YYDEBUGint yydebug;#endifint yynerrs;int yyerrflag;int yychar;YYSTYPE yyval;YYSTYPE yylval;short yyss[YYSTACKSIZE];YYSTYPE yyvs[YYSTACKSIZE];#define yystacksize YYSTACKSIZE#line 1149 "as.y"#line 1096 "y.tab.c"#define YYABORT goto yyabort#define YYACCEPT goto yyaccept#define YYERROR goto yyerrlabintyyparse(){ register int yym, yyn, yystate; register short *yyssp; register YYSTYPE *yyvsp;#if YYDEBUG register char *yys; extern char *getenv(); if (yys = getenv("YYDEBUG")) { yyn = *yys; if (yyn >= '0' && yyn <= '9') yydebug = yyn - '0'; }#endif yynerrs = 0; yyerrflag = 0; yychar = (-1); yyssp = yyss; yyvsp = yyvs; *yyssp = yystate = 0;yyloop: if (yyn = yydefred[yystate]) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0;#if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("yydebug: state %d, reading %d (%s)\n", yystate, yychar, yys); }#endif } if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) {#if YYDEBUG if (yydebug) printf("yydebug: state %d, shifting to state %d\n", yystate, yytable[yyn]);#endif if (yyssp >= yyss + yystacksize - 1) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; yychar = (-1); if (yyerrflag > 0) --yyerrflag; goto yyloop; } if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { yyn = yytable[yyn]; goto yyreduce; } if (yyerrflag) goto yyinrecovery;#ifdef lint goto yynewerror;#endifyynewerror: yyerror("syntax error");#ifdef lint goto yyerrlab;#endifyyerrlab: ++yynerrs;yyinrecovery: if (yyerrflag < 3) { yyerrflag = 3; for (;;) { if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) {#if YYDEBUG if (yydebug) printf("yydebug: state %d, error recovery shifting\ to state %d\n", *yyssp, yytable[yyn]);#endif if (yyssp >= yyss + yystacksize - 1) { goto yyoverflow; } *++yyssp = yystate = yytable[yyn]; *++yyvsp = yylval; goto yyloop; } else {#if YYDEBUG if (yydebug) printf("yydebug: error recovery discarding state %d\n", *yyssp);#endif if (yyssp <= yyss) goto yyabort; --yyssp; --yyvsp; } } } else { if (yychar == 0) goto yyabort;#if YYDEBUG if (yydebug) { yys = 0; if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; if (!yys) yys = "illegal-symbol"; printf("yydebug: state %d, error recovery discards token %d (%s)\n", yystate, yychar, yys); }#endif yychar = (-1); goto yyloop; }yyreduce:#if YYDEBUG if (yydebug) printf("yydebug: state %d, reducing by rule %d (%s)\n", yystate, yyn, yyrule[yyn]);#endif yym = yylen[yyn]; yyval = yyvsp[1-yym]; switch (yyn) {case 2:#line 665 "as.y"{ newident(yyvsp[-1].y_item, DOTTYP); newlabel(yyvsp[-1].y_item);}break;case 3:#line 667 "as.y"{ if (yyvsp[-1].y_valu < 0 || yyvsp[-1].y_valu > 9) { serror("bad f/b label"); yyvsp[-1].y_valu = 0; } newlabel(fb_shift((int)yyvsp[-1].y_valu)); }break;case 4:#line 674 "as.y"{ emit1((int)yyvsp[0].y_valu); if (listflag) listline(0); else if (listtemp) { listflag = listtemp; listeoln = 1; };}break;case 5:#line 676 "as.y"{ emit2((int)yyvsp[0].y_valu); if (listflag) listline(0); else if (listtemp) { listflag = listtemp; listeoln = 1; };}break;case 6:#line 678 "as.y"{ emit4((long)yyvsp[0].y_valu); if (listflag) listline(0); else if (listtemp) { listflag = listtemp; listeoln = 1; };}break;case 8:#line 681 "as.y"{ lineno++; if (listflag) listline(1); else if (listtemp) { listflag = listtemp; listeoln = 1; }; {if (!(relonami == 0)) assert2("/home/ceriel/evert/comm2.y", 129);};}break;case 9:#line 683 "as.y"{ lineno = yyvsp[-2].y_valu; if (modulename) strncpy(modulename, stringbuf, 200 -1); if (listflag) listline(1); else if (listtemp) { listflag = listtemp; listeoln = 1; }; {if (!(relonami == 0)) assert2("/home/ceriel/evert/comm2.y", 133);}; }break;case 10:#line 688 "as.y"{ serror("syntax error"); yyerrok; lineno++; if (listflag) listline(1); else if (listtemp) { listflag = listtemp; listeoln = 1; }; {if (!(relonami == 0)) assert2("/home/ceriel/evert/comm2.y", 137);}; }break;case 12:#line 697 "as.y"{ if (listflag & 1) listcolm += printx(4, yyvsp[0].y_expr.val); newequate(yyvsp[-2].y_item, yyvsp[0].y_expr.typ); store(yyvsp[-2].y_item, yyvsp[0].y_expr.val); }break;case 13:#line 707 "as.y"{ if (yyvsp[0].y_word) listtemp = listmode; else if ((dflag & 01000) == 0) listtemp = 0; }break;case 14:#line 714 "as.y"{ newsect(yyvsp[0].y_item);}break;case 15:#line 716 "as.y"{ newcomm(yyvsp[-2].y_item, yyvsp[0].y_valu);}break;case 16:#line 718 "as.y"{ if (pass == 0) newbase(yyvsp[0].y_valu);}break;case 17:#line 720 "as.y"{ if (yyvsp[0].y_expr.val == 0 && pass == 2) warning("assertion failed"); }break;case 18:#line 723 "as.y"{ o_it = last_it; }break;case 19:#line 725 "as.y"{ if ((sflag & 010 ) && (pass != 0)) { if ( pass == 2 && (yyvsp[-3].y_expr.typ & 0x007F ) == 0x0000 ) { serror("expression undefined"); relonami = -1; } if ( (pass != 0) && (yyvsp[-3].y_expr.typ & 0x1000 ) ) { yyvsp[-3].y_expr.typ = 0x007F ; yyvsp[-3].y_expr.val = new_string(o_it->i_name); relonami = 0; } newsymb( *stringbuf ? stringbuf : (char *) 0, (short)( (yyvsp[-3].y_expr.typ & (0x0080 |0x007F )) | ((unsigned short)yyvsp[-1].y_valu<<8) ), (short)yyvsp[0].y_valu, yyvsp[-3].y_expr.val ); } }break;case 20:#line 764 "as.y"{ if ((sflag & 010 ) && (pass != 0)) { newsymb( *stringbuf ? stringbuf : (char *) 0, (short)( (DOTTYP & (0x0080 |0x007F )) | ((unsigned short)yyvsp[-2].y_valu<<8) ), (short)yyvsp[0].y_valu, (long)DOTVAL ); } }break;case 21:#line 778 "as.y"{ if ((sflag & 020 ) && (pass != 0)) { if (yyvsp[0].y_valu) hllino = (short)yyvsp[0].y_valu; else hllino++; newsymb( (char *)0, (DOTTYP | 0x0200 ), hllino, (long)DOTVAL ); } }break;case 22:#line 792 "as.y"{ if ((sflag & 020 ) && (pass != 0)) { hllino = 0; newsymb( stringbuf, (DOTTYP | 0x0300 ), 0, (long)DOTVAL ); } }break;case 24:#line 804 "as.y"{ align(yyvsp[0].y_valu);}break;case 25:#line 806 "as.y"{ if (DOTSCT == NULL) nosect(); DOTVAL += yyvsp[0].y_valu; DOTSCT->s_zero += yyvsp[0].y_valu; }break;case 27:#line 813 "as.y"{ emitstr(yyvsp[-1].y_word);}break;case 28:#line 817 "as.y"{ yyvsp[0].y_item->i_type |= 0x0080 ;}break;case 29:#line 819 "as.y"{ yyvsp[0].y_item->i_type |= 0x0080 ;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -