⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fbas.i

📁 c编译器实现
💻 I
📖 第 1 页 / 共 3 页
字号:
case 9:# 153 "fbas.y"{	 int align;	 align=yyvsp[0].lex_num;	 while ((seg_offset[seg_cur] % align) != 0) Seg_PutByte(0);;    break;}case 10:# 159 "fbas.y"{	  	 Sym_Declare(yyvsp[-2].lex_ident,-1 ,yyvsp[0].lex_num);	 free(yyvsp[-2].lex_ident);;    break;}case 11:# 165 "fbas.y"{	  	 Sym_Declare(yyvsp[-1].lex_ident,seg_cur,seg_offset[seg_cur]);	 free(yyvsp[-1].lex_ident);;    break;}case 12:# 171 "fbas.y"{	  	 SYM_ENT *s;  printf("id=%s %s\n",yyvsp[0].lex_ident,vm_instr_str[0]);	 s=Hash_Search(yyvsp[0].lex_ident);	 if (s== ((void *)0) ) yyerror("Symbole '%s' non d閒ini",yyvsp[0].lex_ident);	 s->sym_type= 1 ;	 free(yyvsp[0].lex_ident);;    break;}case 13:# 181 "fbas.y"{	  	 Sym_NewPrivate();;    break;}case 14:# 187 "fbas.y"{	 Seg_PutByte(yyvsp[0].lex_num);;    break;}case 15:# 191 "fbas.y"{ 	 Seg_PutByte(yyvsp[0].lex_num); ;    break;}case 17:# 198 "fbas.y"{									 Seg_PutSym(yyvsp[0].lex_num,((void *)0) );	;    break;}case 18:# 201 "fbas.y"{		 Seg_PutSym(0,yyvsp[0].lex_ident);	   free(yyvsp[0].lex_ident);	;    break;}case 19:# 205 "fbas.y"{ 	 		 Seg_PutSym(yyvsp[0].lex_num,yyvsp[-2].lex_ident);	   free(yyvsp[-2].lex_ident);	;    break;}}    # 464 "/usr/lib/bison.simple"  yyvsp -= yylen;  yyssp -= yylen;# 481 "/usr/lib/bison.simple"  *++yyvsp = yyval;# 500 "/usr/lib/bison.simple"     yyn = yyr1[yyn];  yystate = yypgoto[yyn - 20 ] + *yyssp;  if (yystate >= 0 && yystate <= 48  && yycheck[yystate] == *yyssp)    yystate = yytable[yystate];  else    yystate = yydefgoto[yyn - 20 ];  goto yynewstate;yyerrlab:      if (! yyerrstatus)         {      ++yynerrs;# 564 "/usr/lib/bison.simple"	yyerror("parse error");    }  goto yyerrlab1;yyerrlab1:      if (yyerrstatus == 3)    {                    if (yychar == 0 )	return(1) ;      yychar = -2 ;    }     yyerrstatus = 3;		   goto yyerrhandle;yyerrdefault:   yyerrpop:      if (yyssp == yyss) return(1) ;  yyvsp--;  yystate = *--yyssp;# 621 "/usr/lib/bison.simple"yyerrhandle:  yyn = yypact[yystate];  if (yyn == -32768 )    goto yyerrdefault;  yyn += 1 ;  if (yyn < 0 || yyn > 48  || yycheck[yyn] != 1 )    goto yyerrdefault;  yyn = yytable[yyn];  if (yyn < 0)    {      if (yyn == -32768 )	goto yyerrpop;      yyn = -yyn;      goto yyreduce;    }  else if (yyn == 0)    goto yyerrpop;  if (yyn == 34 )    return(0) ;  *++yyvsp = yylval;  yystate = yyn;  goto yynewstate;}# 212 "fbas.y"# 1 "lex.yy.c" 1  # 1 "../lib/stdio.h" 1# 34 "../lib/stdio.h"# 11 "lex.yy.c" 2 # 33 "lex.yy.c"       typedef struct yy_buffer_state *YY_BUFFER_STATE;extern int yyleng;extern FILE *yyin, *yyout;  # 133 "lex.yy.c" typedef unsigned int yy_size_t;struct yy_buffer_state	{	FILE *yy_input_file;	char *yy_ch_buf;		 	char *yy_buf_pos;		 	 	yy_size_t yy_buf_size;	 	int yy_n_chars;	 	int yy_is_our_buffer;	 	int yy_is_interactive;	 	int yy_at_bol;	 	int yy_fill_buffer;	int yy_buffer_status;	 	};static YY_BUFFER_STATE yy_current_buffer = 0;  static char yy_hold_char;static int yy_n_chars;		 int yyleng; static char *yy_c_buf_p = (char *) 0;static int yy_init = 1;		 static int yy_start = 0;	  static int yy_did_buffer_switch_on_eof;void yyrestart  ( FILE *input_file )  ;void yy_switch_to_buffer  ( YY_BUFFER_STATE new_buffer )  ;void yy_load_buffer_state  ( void )  ;YY_BUFFER_STATE yy_create_buffer  ( FILE *file, int size )  ;void yy_delete_buffer  ( YY_BUFFER_STATE b )  ;void yy_init_buffer  ( YY_BUFFER_STATE b, FILE *file )  ;void yy_flush_buffer  ( YY_BUFFER_STATE b )  ;YY_BUFFER_STATE yy_scan_buffer  ( char *base, yy_size_t size )  ;YY_BUFFER_STATE yy_scan_string  ( const  char *str )  ;YY_BUFFER_STATE yy_scan_bytes  ( const  char *bytes, int len )  ;static void *yy_flex_alloc  ( yy_size_t )  ;static void *yy_flex_realloc  ( void *, yy_size_t )  ;static void yy_flex_free  ( void * )  ;typedef unsigned char YY_CHAR;FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;typedef int yy_state_type;extern char *yytext;static yy_state_type yy_get_previous_state  ( void )  ;static yy_state_type yy_try_NUL_trans  ( yy_state_type current_state )  ;static int yy_get_next_buffer  ( void )  ;static void yy_fatal_error  ( const  char msg[] )  ; static const  short int yy_accept[71] =    {   0,        0,    0,    2,    2,   26,   24,    7,    6,   20,   23,       21,   24,   24,   18,   22,   19,    2,    4,    3,   18,        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,        1,   19,    2,    3,    3,    5,    0,    0,    0,    0,        0,    0,    0,    0,    0,    0,    0,    0,    0,   15,        0,   12,    0,    0,    0,    0,    0,   11,    9,    0,        0,    0,    8,   13,   14,   10,    0,   16,   17,    0    } ;static const  int yy_ec[256] =    {   0,        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,        1,    1,    2,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    2,    1,    1,    1,    1,    1,    1,    1,    1,        1,    4,    5,    6,    7,    8,    9,   10,   10,   10,       10,   10,   10,   10,   10,   10,   10,   11,    1,    1,        1,    1,    1,   12,   12,   12,   12,   12,   12,   12,       12,   12,   12,   12,   12,   12,   12,   12,   12,   12,       12,   12,   12,   12,   12,   12,   12,   12,   12,   12,        1,    1,    1,    1,   12,    1,   13,   14,   12,   15,       16,   12,   17,   18,   19,   12,   12,   20,   21,   22,       23,   12,   24,   25,   26,   27,   28,   12,   12,   29,       30,   31,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    1,    1,    1,    1    } ;static const  int yy_meta[32] =    {   0,        1,    1,    2,    3,    1,    1,    1,    1,    1,    4,        1,    4,    4,    4,    4,    4,    4,    4,    4,    4,        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,        4    } ;static const  short int yy_base[76] =    {   0,        0,   11,   20,   22,   94,   95,   95,   95,   95,   95,       83,   14,   88,   81,   95,    0,    0,   95,   28,   80,       69,   58,   74,   62,   65,   62,   60,   64,   65,   64,       95,    0,    0,   30,   34,   95,   60,   51,   50,   48,       52,   47,   58,   49,   42,   45,   52,   52,   54,   95,       52,   95,   37,   39,   36,   39,   37,   95,   95,   36,       35,   17,   95,   95,   95,   95,   26,   95,   95,   95,       45,   49,   32,   53,   57    } ;static const  short int yy_def[76] =    {   0,       71,   71,   72,   72,   70,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   73,   74,   70,   75,   70,       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,       70,   73,   74,   75,   75,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70,   70,   70,   70,    0,       70,   70,   70,   70,   70    } ;static const  short int yy_nxt[127] =    {   0,        6,    7,    8,    6,    9,   10,   11,   12,   13,   14,       15,    6,    7,    8,    6,    9,   10,   11,   12,   13,       14,   15,   18,   19,   18,   19,   21,   22,   23,   24,       25,   35,   26,   70,   27,   32,   36,   35,   70,   28,       29,   69,   70,   68,   30,   16,   16,   16,   16,   17,       17,   17,   17,   33,   67,   66,   33,   34,   65,   34,       34,   64,   63,   62,   61,   60,   59,   58,   57,   56,       55,   54,   53,   52,   51,   50,   49,   48,   47,   46,       45,   44,   43,   42,   41,   40,   39,   38,   37,   20,       20,   31,   20,   70,    5,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70    } ;static const  short int yy_chk[127] =    {   0,        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,        1,    2,    2,    2,    2,    2,    2,    2,    2,    2,        2,    2,    3,    3,    4,    4,   12,   12,   12,   12,       12,   19,   12,   34,   12,   73,   19,   35,   34,   12,       12,   67,   35,   62,   12,   71,   71,   71,   71,   72,       72,   72,   72,   74,   61,   60,   74,   75,   57,   75,       75,   56,   55,   54,   53,   51,   49,   48,   47,   46,       45,   44,   43,   42,   41,   40,   39,   38,   37,   30,       29,   28,   27,   26,   25,   24,   23,   22,   21,   20,       14,   13,   11,    5,   70,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70,   70,   70,   70,   70,       70,   70,   70,   70,   70,   70    } ;static yy_state_type yy_last_accepting_state;static char *yy_last_accepting_cpos; char *yytext;# 1 "fbas_lex.l"# 1 "fbas_lex.l"# 413 "lex.yy.c" extern int yywrap  ( void )  ;static void yyunput  ( int c, char *buf_ptr )  ;static int input  ( void )  ;# 457 "lex.yy.c"    # 512 "lex.yy.c"      int yylex  ( void )   	{	register yy_state_type yy_current_state;	register char *yy_cp, *yy_bp;	register int yy_act;# 11 "fbas_lex.l"# 563 "lex.yy.c"	if ( yy_init )		{		yy_init = 0;		if ( ! yy_start )			yy_start = 1;	 		if ( ! yyin )			yyin = stdin;		if ( ! yyout )			yyout = stdout;		if ( ! yy_current_buffer )			yy_current_buffer =				yy_create_buffer( yyin, 16384  );		yy_load_buffer_state();		}	while ( 1 )		 		{		yy_cp = yy_c_buf_p;		 		*yy_cp = yy_hold_char;		 		yy_bp = yy_cp;		yy_current_state = yy_start;yy_match:		do			{			register YY_CHAR yy_c = yy_ec[((unsigned int) (unsigned char)  *yy_cp ) ];			if ( yy_accept[yy_current_state] )				{				yy_last_accepting_state = yy_current_state;				yy_last_accepting_cpos = yy_cp;				}			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )				{				yy_current_state = (int) yy_def[yy_current_state];				if ( yy_current_state >= 71 )					yy_c = yy_meta[(unsigned int) yy_c];				}			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];			++yy_cp;			}		while ( yy_base[yy_current_state] != 95 );yy_find_action:		yy_act = yy_accept[yy_current_state];		if ( yy_act == 0 )			{  			yy_cp = yy_last_accepting_cpos;			yy_current_state = yy_last_accepting_state;			yy_act = yy_accept[yy_current_state];			}		yytext  = yy_bp; yyleng = (int) (yy_cp - yy_bp); yy_hold_char = *yy_cp; *yy_cp = '\0'; yy_c_buf_p = yy_cp; ;do_action:	 		switch ( yy_act )	{  			case 0:  			 			*yy_cp = yy_hold_char;			yy_cp = yy_last_accepting_cpos;			yy_current_state = yy_last_accepting_state;			goto yy_find_action;case 1:  # 13 "fbas_lex.l"{ yy_start = 1 + 2 * (1 ); }	break; case 2:  # 14 "fbas_lex.l"{ }	break; case 3:  # 15 "fbas_lex.l"{ }	break; case 4:  # 16 "fbas_lex.l"{ lex_linenum++; }	break; case 5:  # 17 "fbas_lex.l"{ yy_start = 1 + 2 * (0 ); }	break; case 6:  # 20 "fbas_lex.l"{ lex_linenum++; }	break; case 7:  # 21 "fbas_lex.l" 	break; case 8:  # 23 "fbas_lex.l"{ return 258 ; }	break; case 9:  # 24 "fbas_lex.l"{ return 259 ; }	break; case 10:  # 25 "fbas_lex.l"{ return 261 ; }	break; case 11:  # 26 "fbas_lex.l"{ return 260 ; }	break; case 12:  # 27 "fbas_lex.l"{ return 262 ; }	break; case 13:  # 28 "fbas_lex.l"{ return 264 ; }	break; case 14:  # 29 "fbas_lex.l"{ return 265 ; }	break; case 15:  # 30 "fbas_lex.l"{ return 266 ; }	break; case 16:  # 31 "fbas_lex.l"{ return 263 ; }	break; case 17:  # 32 "fbas_lex.l"{ return 267 ; }	break; case 18:  # 34 "fbas_lex.l"{   int sign,n;	 char *p;	 p=yytext;	 n=0;	 sign=1;	 if (*p=='-') {			sign=-1;			p++;	 }	 while (*p!='\0') {			n=n*10+(*p - '0');			p++;	 }	 n=n*sign;	 yylval.lex_num=n;    return 271 ;}	break; case 19:  # 54 "fbas_lex.l"{	  	 char **p;	 int c;	 p=vm_instr_str;	 while (1) {			if (*p == ((void *)0) ) {				 yylval.lex_ident=malloc(strlen(yytext)+1);				 strcpy(yylval.lex_ident,yytext);				 return 270 ;			}			if (strcmp(*p,yytext)==0) {				 c=p-vm_instr_str;				 yylval.lex_num=c;				 switch(c) {					case jmp:					case jsr:					case jeq_i:					case jne_i:					case li_i:					case libp_i:					case addsp:					case libcall:						return 269 ;					default:						return 268 ;				 }			}			p++;	 }}	break; case 20:  # 86 "fbas_lex.l"{ return '+'; }	break; case 21:  # 87 "fbas_lex.l"{ return '-'; }	break; case 22:  # 88 "fbas_lex.l"{ return ':'; }	break; case 23:  # 89 "fbas_lex.l"{ return ','; }	break; case 24:  # 91 "fbas_lex.l"{ yyerror("Caract鑢e non reconnu"); }	break; case 25:  # 93 "fbas_lex.l"(void) fwrite( yytext, yyleng, 1, yyout ) ;	break; # 819 "lex.yy.c"case (26  +  0   + 1) :case (26  +  1   + 1) :	return 0  ;	case 26 :		{		 		int yy_amount_of_matched_text = (int) (yy_cp - yytext ) - 1;		 		*yy_cp = yy_hold_char;		if ( yy_current_buffer->yy_buffer_status == 0  )			{			 			yy_n_chars = yy_current_buffer->yy_n_chars;			yy_current_buffer->yy_input_file = yyin;			yy_current_buffer->yy_buffer_status = 1 ;			}		 		if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )			{  			yy_state_type yy_next_state;			yy_c_buf_p = yytext  + yy_amount_of_matched_text;			yy_current_state = yy_get_previous_state();			 			yy_next_state = yy_try_NUL_trans( yy_current_state );			yy_bp = yytext  + 0 ;			if ( yy_next_state )				{				 				yy_cp = ++yy_c_buf_p;				yy_current_state = yy_next_state;				goto yy_match;				}			else				{				yy_cp = yy_c_buf_p;				goto yy_find_action;				}			}		else switch ( yy_get_next_buffer() )			{			case 1 :				{				yy_did_buffer_switch_on_eof = 0;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -