📄 y.tab.c
字号:
char *SetStructName(argc, argv) int argc; char **argv; { gStructName = strdup(argv[0]); return NULL; }char *InitTokenTypedToTrue() { gTokenTyped = 1; return NULL; }char *InitTokenTypedToFalse() { gTokenTyped = 0; return NULL; }char *InitNonTerminalTypedToTrue() { gNonTerminalTyped = 1; return NULL; } char *InitNonTerminalTypedToFalse() { gNonTerminalTyped = 0; return NULL; }char *PrintType() { printf("<%s>", gStructName); return NULL; }char *PrintTypeUntypedTokens() { int i; TokenNodeHdl cur = gTokenList; int started = 0; while (cur != NULL) { if (cur->typed == 0) { if (started == 0) { printf("%%token "); PrintType(); started = 1; } printf(" %s", cur->tokenName); } cur = cur->next; } if (started = 1) { printf("\n"); } return NULL; }char *PrintTypeUntypedNonTerminals() { int i; NonTerminalNodeHdl cur = gNonTerminalList; int started = 0; while (cur != NULL) { if (cur->typed == 0) { if (started == 0) { printf("\n%%type "); PrintType(); started = 1; } printf(" %s", cur->nonTerminalName); } cur = cur->next; } return NULL; }char *PrintNewPseudoTokens() { TokenNodeHdl cur = gTokenList; while(cur != NULL) { if (cur->thisPrecedence) { printf(" %s", cur->newPseudoTokenName); cur->thisPrecedence = 0; } cur = cur->next; } return NULL; }char *MarkWithThisPrec(argc, argv) int argc; char **argv; { TokenNodeHdl cur = gTokenList; int found = 0; while((cur != NULL) && (!found)) { if(strcmp(cur->tokenName, argv[0]) == 0) { found = 1; cur->thisPrecedence = 1; } cur = cur->next; } return NULL; } char *MarkWithPrec(argc, argv) int argc; char **argv; { TokenNodeHdl cur = gTokenList; int found = 0; while((cur != NULL) && (!found)) { if(strcmp(cur->tokenName, argv[0]) == 0) { found = 1; cur->precedence = 1; } cur = cur->next; } return NULL; }char *InitCurPrec() { gCurPrec = NULL; return NULL; }char *PrintNonPrecedence() { if (gCurPrec != NULL) { printf(" %%prec %s", gCurPrec->newPseudoTokenName); } return NULL; }char *myprint(s)char *s;{ if(s != 0) fputs(s,stdout); return NULL;}yyerror(){ fprintf(stderr, "syntax error on line %d\n",yylineno); fflush(stderr); exit(1);}main(){ if (yyparse() != 0) {fprintf(stderr,"exiting"); exit(1); } nyprint(myprint,P,NY_OPEN,NY_NORMAL);}static const yytabelem yyexca[] ={-1, 1, 0, -1, -2, 0, };# define YYNPROD 65# define YYLAST 254static const yytabelem yyact[]={ 81, 91, 92, 90, 87, 96, 13, 16, 15, 14, 17, 98, 86, 64, 38, 22, 21, 7, 5, 61, 12, 54, 20, 41, 42, 36, 30, 31, 13, 16, 15, 14, 17, 72, 100, 69, 66, 44, 43, 20, 55, 61, 50, 24, 71, 93, 83, 53, 52, 27, 26, 99, 94, 37, 58, 40, 48, 19, 6, 29, 28, 4, 46, 85, 84, 8, 80, 79, 70, 23, 59, 57, 49, 47, 65, 39, 35, 32, 33, 25, 11, 95, 10, 9, 3, 34, 18, 2, 45, 1, 0, 73, 45, 45, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 68, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 0, 60, 62, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77, 76, 75, 74, 78, 0, 0, 82, 0, 88, 89 };static const yytabelem yypact[]={ -250,-10000000, -248,-10000000,-10000000,-10000000, -251, -224,-10000000, -254,-10000000,-10000000, -80, -10, -11, -237, -237, -237, -241,-10000000, -5,-10000000,-10000000, -229, -258, -240, -225, -226, -237,-10000000,-10000000,-10000000, -237, -237,-10000000,-10000000,-10000000,-10000000, -81, -240,-10000000,-10000000,-10000000, -14, -15,-10000000, -246, -19,-10000000, -104, -260,-10000000,-10000000, -227,-10000000,-10000000,-10000000, -82,-10000000,-10000000, -228,-10000000,-10000000,-10000000, -76, -230,-10000000,-10000000,-10000000,-10000000, -34, -45,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -262, -30, -284, -48,-10000000,-10000000,-10000000,-10000000,-10000000,-10000000, -7,-10000000, -120, -264,-10000000, -8, -91,-10000000 };static const yytabelem yypgo[]={ 0, 89, 87, 86, 85, 84, 61, 83, 58, 82, 81, 80, 79, 75, 74, 60, 55, 59, 57, 73, 56, 72, 71, 54, 70, 68, 67, 66, 64, 63, 62 };static const yytabelem yyr1[]={ 0, 1, 2, 2, 5, 7, 7, 6, 9, 10, 10, 8, 8, 11, 11, 11, 11, 11, 12, 12, 13, 13, 16, 16, 14, 14, 15, 15, 17, 17, 3, 3, 18, 19, 19, 20, 20, 20, 20, 21, 21, 24, 24, 22, 23, 25, 25, 25, 25, 25, 25, 25, 25, 26, 28, 28, 28, 27, 29, 29, 29, 4, 4, 30, 30 };static const yytabelem yyr2[]={ 0, 9, 5, 3, 7, 5, 1, 7, 31, 5, 1, 5, 1, 7, 11, 5, 5, 5, 1, 7, 5, 3, 3, 3, 5, 3, 5, 3, 3, 3, 5, 3, 9, 7, 3, 7, 5, 5, 3, 5, 1, 3, 3, 5, 7, 5, 5, 5, 5, 5, 5, 5, 1, 7, 5, 5, 1, 7, 5, 5, 1, 1, 5, 5, 1 };static const yytabelem yychk[]={-10000000, -1, -2, -5, -6, 268, -8, 265, -6, -7, -9, -11, 271, 257, 260, 259, 258, 261, -3, -18, 263, 270, 269, -8, 123, -12, 60, 60, -15, -17, 263, 264, -15, -15, -4, -18, 266, 58, 272, -13, -16, 263, 264, 263, 263, -17, -30, -19, -20, -21, 123, -16, 62, 62, 267, 59, 124, -22, -23, -24, 262, 123, 263, 264, 273, -14, 263, -20, -23, 263, -25, 120, 263, 125, 280, 279, 278, 277, 281, -26, -27, 34, 284, 91, -28, -29, 274, 34, 282, 283, 287, 285, 286, 93, 59, -10, 125, 276, 275, 59, 125 };static const yytabelem yydef[]={ 12, -2, 0, 12, 3, 6, 0, 0, 2, 0, 12, 11, 0, 18, 0, 0, 0, 0, 61, 31, 0, 4, 5, 7, 0, 0, 0, 0, 15, 27, 28, 29, 16, 17, 1, 30, 64, 40, 0, 13, 21, 22, 23, 0, 0, 26, 62, 0, 34, 38, 0, 20, 19, 0, 63, 32, 40, 37, 36, 39, 0, 52, 41, 42, 0, 14, 25, 33, 35, 43, 0, 0, 24, 44, 45, 46, 47, 48, 49, 50, 51, 56, 60, 0, 0, 0, 0, 53, 54, 55, 57, 58, 59, 0, 10, 0, 0, 9, 0, 0, 8 };typedef struct#ifdef __cplusplus yytoktype#endif{ char *t_name; int t_val; } yytoktype;#ifndef YYDEBUG# define YYDEBUG 0 /* don't allow debugging */#endif#if YYDEBUGyytoktype yytoks[] ={ "TOKEN_T", 257, "LEFT_T", 258, "RIGHT_T", 259, "TYPE_T", 260, "NONASSOC_T", 261, "PREC_T", 262, "NAME", 263, "CHAR", 264, "DIVIDER", 265, "ENDDIVIDER", 266, "ENDCHAR", 267, "LCURL", 268, "CCHAR", 269, "RCURL", 270, "UNION_T", 271, "STRUCT_U", 272, "INT_U", 273, "INT", 274, "NAME_U", 275, "UCHAR", 276, "ALCURLY", 277, "ASPACE", 278, "ARETURN", 279, "ACHAR", 280, "ARCURLY", 281, "SQUOAT", 282, "SCHAR", 283, "BEGINLIT", 284, "LQUOAT", 285, "LCHAR", 286, "ENDLIT", 287, "JUNK", 288, "-unknown-", -1 /* ends search */};char * yyreds[] ={ "-no such reduction-", "yacc_spec : begining DIVIDER rule_list ending", "begining : cCode defn_list_complete", "begining : defn_list_complete", "cCode : LCURL cList RCURL", "cList : cList CCHAR", "cList : /* empty */", "defn_list_complete : defn_list union_defn defn_list", "union_defn : UNION_T '{' STRUCT_U '{' INT_U 'x' '[' INT ']' ';' union_list '}' NAME_U ';' '}'", "union_list : union_list UCHAR", "union_list : /* empty */", "defn_list : defn_list defn", "defn_list : /* empty */", "defn : TOKEN_T opt_type token_list", "defn : TYPE_T '<' NAME '>' type_list", "defn : RIGHT_T prec_list", "defn : LEFT_T prec_list", "defn : NONASSOC_T prec_list", "opt_type : /* empty */", "opt_type : '<' NAME '>'", "token_list : token_list token_elem", "token_list : token_elem", "token_elem : NAME", "token_elem : CHAR", "type_list : type_list NAME", "type_list : NAME", "prec_list : prec_list prec_elem", "prec_list : prec_elem", "prec_elem : NAME", "prec_elem : CHAR", "rule_list : rule_list rule", "rule_list : rule", "rule : NAME ':' rhs_list ';'", "rhs_list : rhs_list '|' production", "rhs_list : production", "production : production_list precedence action", "production : production_list action", "production : production_list precedence", "production : production_list", "production_list : production_list production_elem", "production_list : /* empty */", "production_elem : NAME", "production_elem : CHAR", "precedence : PREC_T NAME", "action : '{' action_list '}'", "action_list : action_list ACHAR", "action_list : action_list ARETURN", "action_list : action_list ASPACE", "action_list : action_list ALCURLY", "action_list : action_list ARCURLY", "action_list : action_list string", "action_list : action_list lit", "action_list : /* empty */", "string : '\"' string_list '\"'", "string_list : string_list SQUOAT", "string_list : string_list SCHAR", "string_list : /* empty */", "lit : BEGINLIT lit_list ENDLIT", "lit_list : lit_list LQUOAT", "lit_list : lit_list LCHAR", "lit_list : /* empty */", "ending : /* empty */", "ending : ENDDIVIDER ending_list", "ending_list : ending_list ENDCHAR", "ending_list : /* empty */",};#endif /* YYDEBUG */# line 1 "/usr/ccs/bin/yaccpar"/* * Copyright (c) 1993 by Sun Microsystems, Inc. */#pragma ident "@(#)yaccpar 6.14 97/01/16 SMI"/*** Skeleton parser driver for yacc output*//*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -