yas-grammar.c

来自「深入理解计算机系统 的lab」· C语言 代码 · 共 1,835 行 · 第 1/4 页

C
1,835
字号
       21,   30,   31,   32,   21,   21,   21,   21,   33,   21,       34,   35,   36,   37,   38,   39,   40,   41,   34,   42,       43,   44,   45,   46,   47,   47,   47,   34,   48,   47,       49,   47,   47,   47,   50,   51,   52,   53,   54,   55,       47,   56,   57,   58,   47,   47,   47,   47,   59,   47,       61,   61,   61,   61,   63,   64,   65,   64,   65,   67,       68,   71,   71,   72,   73,   71,   71,   71,   71,   78,       80,   84,   74,  157,   86,   87,   75,   86,   81,   88,       89,   90,   76,   94,   96,   85,  102,  103,   95,  200,       97,   78,  105,  106,   98,  104,  105,  106,  108,  109,      102,  103,  200,  110,  102,  103,  102,  103,  102,  103,      102,  103,  102,  103,  143,  143,  118,   86,  112,  112,      102,  103,  112,  112,  111,  102,  103,   64,   65,  123,      112,  112,  120,  124,  119,  125,  120,  120,  120,   86,      120,  113,  114,   86,  120,  120,  120,  120,  132,  126,      115,  120,  127,  128,  116,  120,  119,  129,  130,  131,      117,  101,  101,  102,  103,  101,  101,  101,  101,  101,      101,  101,  101,  101,  101,  102,  103,  101,  101,  101,      101,  101,  101,  101,  101,  120,  200,  120,  204,  120,      230,  120,  200,  120,  121,  120,  133,  120,  134,  120,      135,  140,  122,  120,  137,  136,  229,  120,   67,   68,      138,  120,   67,   68,  139,  120,  141,   63,   64,   65,      144,  145,  146,  147,   71,   71,  155,  156,  102,  103,      102,  103,  104,  105,  106,  148,  105,  106,  108,  109,      108,  109,  102,  103,   86,  110,  102,  103,  102,  103,      102,  103,  102,  103,  102,  103,  102,  103,  112,  112,      102,  103,  172,  173,  174,  175,  183,  184,  186,  228,      187,   86,  190,  120,  227,  177,  120,  176,  120,  188,      120,  120,  179,   86,  180,  120,  120,  120,  181,  178,      102,  103,  189,  120,  120,  120,  120,  120,  127,  195,      185,  185,  185,  191,  120,  120,  185,  185,  185,  185,      185,  120,  127,  120,  120,  127,  204,  192,  120,  120,      120,  120,  120,  127,  120,  193,  120,  120,  120,  200,      120,  204,  120,  120,  127,  120,  200,  194,  120,  120,      196,  120,  198,  127,  120,  120,  197,  120,  143,  143,      155,  156,  120,  120,  155,  156,  199,  102,  103,  102,      103,  102,  103,  102,  103,  183,  184,  102,  103,  102,      103,  102,  103,  102,  103,  102,  103,  102,  103,  183,      184,  120,  204,  219,  102,  103,  213,  127,  213,  120,      213,  120,  214,  213,  226,  213,  213,  213,   86,  213,      216,  120,  120,  215,   86,  120,  217,  218,  127,  120,      120,  127,  120,  120,  127,  120,  120,  102,  103,  120,      120,  220,  223,  120,  120,  222,  120,  120,  120,  212,      221,  120,  127,  211,  120,  120,  120,  224,  120,  120,      225,  127,  210,  120,  127,   86,  120,  102,  103,  102,      103,  102,  103,  120,  102,  103,  120,  120,  127,  127,      209,  120,  120,  208,  120,  120,  102,  103,  231,  217,      120,  232,  217,  217,  120,  120,  120,  233,  207,  120,      127,  206,  120,  120,  120,  127,  120,  120,   86,  120,      234,  235,  127,  217,  120,  127,  120,  120,   86,   86,       86,  205,  127,  204,  120,   60,   60,   60,   62,   62,       62,   66,   66,   66,   79,   79,  101,  101,  101,  107,      107,  107,  120,  120,  120,  142,  142,  142,  154,  154,      154,  182,  182,  182,  203,  202,  201,  200,  200,  171,      170,  169,  168,   86,  167,  166,   86,  165,  164,   86,       86,   86,   86,  163,  162,  161,  160,  159,  158,  153,      152,  151,  150,  149,   69,  100,   99,   93,   92,   91,       83,   82,   77,   70,   69,  236,    7,  236,  236,  236,      236,  236,  236,  236,  236,  236,  236,  236,  236,  236,      236,  236,  236,  236,  236,  236,  236,  236,  236,  236,      236,  236,  236,  236,  236,  236,  236,  236,  236,  236,      236,  236,  236,  236,  236,  236,  236    } ;static yyconst short int yy_chk[648] =    {   0,        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,        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,        2,    2,    2,    2,    2,    2,    2,    2,    2,    2,        3,    3,    4,    4,    9,    9,    9,   11,   11,   12,       12,   16,   16,   17,   17,   19,   19,   20,   20,   19,       22,   25,   17,  246,   26,   26,   17,  230,   22,   26,       26,   26,   17,   30,   31,   25,   34,   34,   30,  147,       31,   19,   37,   37,   31,   35,   35,   35,   38,   38,       39,   39,  147,   39,   40,   40,   41,   41,   42,   42,       44,   44,   46,   46,   60,   60,   44,  229,   42,   42,       45,   45,   46,   46,   40,   43,   43,   65,   65,   49,       45,   45,   49,   50,   45,   51,   50,  120,   51,  228,       49,   43,   43,  227,   50,  120,   51,   53,   53,   51,       43,   52,   52,   52,   43,   53,   45,   52,   52,   52,       43,   47,   47,   47,   47,   47,   47,   47,   47,   47,       47,   47,   47,   48,   48,   48,   48,   48,   48,   48,       48,   48,   48,   48,   48,   54,  148,   58,  226,   55,      212,   56,  148,   54,   48,   58,   54,   55,   55,   56,       56,   58,   48,   57,   57,   56,  211,   59,   66,   66,       57,   57,   68,   68,   57,   59,   59,   63,   63,   63,       70,   70,   70,   70,   71,   71,   77,   77,  101,  101,      103,  103,  104,  104,  104,   70,  106,  106,  107,  107,      109,  109,  110,  110,  210,  110,  111,  111,  112,  112,      113,  113,  114,  114,  115,  115,  116,  116,  112,  112,      117,  117,  111,  111,  111,  111,  118,  118,  121,  209,      122,  208,  125,  123,  207,  113,  121,  111,  122,  123,      125,  123,  115,  206,  116,  127,  124,  136,  117,  114,      119,  119,  124,  127,  124,  136,  126,  128,  128,  136,      119,  119,  119,  126,  126,  128,  119,  119,  119,  119,      119,  129,  129,  130,  131,  131,  205,  132,  133,  129,      132,  130,  131,  130,  134,  133,  133,  135,  132,  145,      137,  203,  134,  138,  134,  135,  145,  135,  137,  139,      138,  138,  140,  137,  140,  141,  139,  139,  142,  142,      154,  154,  140,  141,  156,  156,  141,  172,  172,  173,      173,  174,  174,  175,  175,  182,  182,  176,  176,  177,      177,  178,  178,  179,  179,  180,  180,  181,  181,  184,      184,  186,  202,  190,  213,  213,  175,  186,  173,  186,      176,  190,  177,  172,  201,  173,  176,  174,  171,  175,      179,  189,  187,  178,  170,  188,  180,  181,  187,  189,      187,  188,  191,  188,  189,  192,  193,  217,  217,  195,      191,  191,  195,  192,  193,  193,  194,  195,  196,  169,      192,  197,  194,  168,  194,  198,  196,  196,  199,  197,      197,  198,  167,  198,  199,  166,  199,  214,  214,  215,      215,  216,  216,  219,  218,  218,  220,  221,  221,  219,      165,  219,  222,  164,  220,  221,  231,  231,  214,  215,      222,  220,  216,  218,  223,  224,  225,  222,  163,  232,      223,  162,  223,  224,  225,  232,  233,  232,  161,  234,      224,  225,  233,  231,  233,  234,  235,  234,  160,  159,      158,  153,  235,  152,  235,  237,  237,  237,  238,  238,      238,  239,  239,  239,  240,  240,  241,  241,  241,  242,      242,  242,  243,  243,  243,  244,  244,  244,  245,  245,      245,  247,  247,  247,  151,  150,  149,  146,  144,  100,       99,   98,   97,   96,   95,   94,   93,   92,   91,   90,       89,   88,   87,   85,   84,   83,   82,   81,   80,   76,       75,   74,   73,   72,   69,   33,   32,   29,   28,   27,       24,   23,   18,   14,   13,    7,  236,  236,  236,  236,      236,  236,  236,  236,  236,  236,  236,  236,  236,  236,      236,  236,  236,  236,  236,  236,  236,  236,  236,  236,      236,  236,  236,  236,  236,  236,  236,  236,  236,  236,      236,  236,  236,  236,  236,  236,  236    } ;static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;static char *yy_full_match;static int yy_lp;#define REJECT \{ \*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \yy_cp = yy_full_match; /* restore poss. backed-over text */ \++yy_lp; \goto find_rule; \}#define yymore() yymore_used_but_not_detected#define YY_MORE_ADJ 0#define YY_RESTORE_YY_MORE_OFFSETchar *yytext;#line 1 "yas-grammar.lex"#define INITIAL 0/* Grammar for Y86 Assembler */#include "yas.h"unsigned int atoh(const char *);#define ERR 1#define COM 2#line 628 "lex.yy.c"/* Macros after this point can all be overridden by user definitions in * section 1. */#ifndef YY_SKIP_YYWRAP#ifdef __cplusplusextern "C" int yywrap YY_PROTO(( void ));#elseextern int yywrap YY_PROTO(( void ));#endif#endif#ifndef YY_NO_UNPUTstatic void yyunput YY_PROTO(( int c, char *buf_ptr ));#endif#ifndef yytext_ptrstatic void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));#endif#ifdef YY_NEED_STRLENstatic int yy_flex_strlen YY_PROTO(( yyconst char * ));#endif#ifndef YY_NO_INPUT#ifdef __cplusplusstatic int yyinput YY_PROTO(( void ));#elsestatic int input YY_PROTO(( void ));#endif#endif#if YY_STACK_USEDstatic int yy_start_stack_ptr = 0;static int yy_start_stack_depth = 0;static int *yy_start_stack = 0;#ifndef YY_NO_PUSH_STATEstatic void yy_push_state YY_PROTO(( int new_state ));#endif#ifndef YY_NO_POP_STATEstatic void yy_pop_state YY_PROTO(( void ));#endif#ifndef YY_NO_TOP_STATEstatic int yy_top_state YY_PROTO(( void ));#endif#else#define YY_NO_PUSH_STATE 1#define YY_NO_POP_STATE 1#define YY_NO_TOP_STATE 1#endif#ifdef YY_MALLOC_DECLYY_MALLOC_DECL#else#if __STDC__#ifndef __cplusplus#include <stdlib.h>#endif#else/* Just try to get by without declaring the routines.  This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */#endif#endif/* Amount of stuff to slurp up with each read. */#ifndef YY_READ_BUF_SIZE#define YY_READ_BUF_SIZE 8192#endif/* Copy whatever the last rule matched to the standard output. */#ifndef ECHO/* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )#endif/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL, * is returned in "result". */#ifndef YY_INPUT#define YY_INPUT(buf,result,max_size) \	if ( yy_current_buffer->yy_is_interactive ) \		{ \		int c = '*', n; \		for ( n = 0; n < max_size && \			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \			buf[n] = (char) c; \		if ( c == '\n' ) \			buf[n++] = (char) c; \		if ( c == EOF && ferror( yyin ) ) \			YY_FATAL_ERROR( "input in flex scanner failed" ); \		result = n; \		} \	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \		  && ferror( yyin ) ) \		YY_FATAL_ERROR( "input in flex scanner failed" );#endif/* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */#ifndef yyterminate#define yyterminate() return YY_NULL#endif/* Number of entries by which start-condition stack grows. */#ifndef YY_START_STACK_INCR#define YY_START_STACK_INCR 25#endif/* Report a fatal error. */#ifndef YY_FATAL_ERROR#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )#endif/* Default declaration of generated scanner - a define so the user can * easily add parameters. */#ifndef YY_DECL#define YY_DECL int yylex YY_PROTO(( void ))#endif/* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */#ifndef YY_USER_ACTION#define YY_USER_ACTION#endif/* Code executed at the end of each rule. */#ifndef YY_BREAK#define YY_BREAK break;#endif#define YY_RULE_SETUP \	if ( yyleng > 0 ) \		yy_current_buffer->yy_at_bol = \				(yytext[yyleng - 1] == '\n'); \	YY_USER_ACTIONYY_DECL	{	register yy_state_type yy_current_state;	register char *yy_cp = NULL, *yy_bp = NULL;	register int yy_act;#line 17 "yas-grammar.lex"#line 785 "lex.yy.c"	if ( yy_init )		{		yy_init = 0;#ifdef YY_USER_INIT		YY_USER_INIT;#endif		if ( ! yy_start )			yy_start = 1;	/* first start state */		if ( ! yyin )			yyin = stdin;		if ( ! yyout )			yyout = stdout;		if ( ! yy_current_buffer )			yy_current_buffer =				yy_create_buffer( yyin, YY_BUF_SIZE );		yy_load_buffer_state();		}	while ( 1 )		/* loops until end-of-file is reached */		{		yy_cp = yy_c_buf_p;		/* Support of yytext. */		*yy_cp = yy_hold_char;		/* yy_bp points to the position in yy_ch_buf of the start of		 * the current run.		 */		yy_bp = yy_cp;		yy_current_state = yy_start;		yy_current_state += YY_AT_BOL();		yy_state_ptr = yy_state_buf;		*yy_state_ptr++ = yy_current_state;yy_match:		do			{			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*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 >= 237 )					yy_c = yy_meta[(unsigned int) yy_c];				}			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];			*yy_state_ptr++ = yy_current_state;			++yy_cp;			}		while ( yy_base[yy_current_state] != 607 );yy_find_action:		yy_current_state = *--yy_state_ptr;		yy_lp = yy_accept[yy_current_state];find_rule: /* we branch to this label when backing up */		for ( ; ; ) /* until we find what rule we matched */			{			if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )				{				yy_act = yy_acclist[yy_lp];					{					yy_full_match = yy_cp;					break;					}				}			--yy_cp;			yy_current_state = *--yy_state_ptr;			yy_lp = yy_accept[yy_current_state];			}		YY_DO_BEFORE_ACTION;do_action:	/* This label is used only to access EOF actions. */		switch ( yy_act )	{ /* beginning of action switch */case 1:YY_RULE_SETUP#line 19 "yas-grammar.lex"{ save_line(yytext); REJECT;} /* Snarf input line */	YY_BREAKcase 2:YY_RULE_SETUP#line 20 "yas-grammar.lex"{finish_line(); lineno++;}	YY_BREAKcase 3:YY_RULE_SETUP#line 21 "yas-grammar.lex"{finish_line(); lineno++;}	YY_BREAKcase 4:YY_RULE_SETUP#line 22 "yas-grammar.lex"{finish_line(); lineno++;}	YY_BREAKcase 5:YY_RULE_SETUP#line 25 "yas-grammar.lex";	YY_BREAKcase 6:YY_RULE_SETUP#line 26 "yas-grammar.lex";	YY_BREAKcase 7:YY_RULE_SETUP#line 27 "yas-grammar.lex"add_instr(yytext);	YY_BREAKcase 8:YY_RULE_SETUP#line 28 "yas-grammar.lex"add_reg(yytext);	YY_BREAKcase 9:YY_RULE_SETUP#line 29 "yas-grammar.lex"add_num(atoi(yytext));	YY_BREAKcase 10:YY_RULE_SETUP#line 30 "yas-grammar.lex"add_num(atoh(yytext));	YY_BREAK

⌨️ 快捷键说明

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