#ifndef lint static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93"; #endif #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 #define yyclearin (yychar=(-1)) #define yyerrok (yyerrflag=0) #define YYRECOVERING (yyerrflag!=0) #define YYPREFIX "yy" #line 38 "gram.y" #include #include #include "options.h" void yyerror (const char *); int yylex (void); #line 48 "gram.y" typedef union { char *str; int val; } YYSTYPE; #line 26 "y.tab.c" #define BASE 257 #define ENTRY 258 #define SIZE 259 #define OFFSET 260 #define DEVICE 261 #define OPTIONS 262 #define IMAGE 263 #define R0 264 #define R1 265 #define R2 266 #define R3 267 #define EXEC 268 #define BAUD 269 #define OTHERFILE 270 #define OTHERBASE 271 #define NUMBER 272 #define WORD 273 #define PATH 274 #define YYERRCODE 256 short yylhs[] = { -1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, }; short yylen[] = { 2, 0, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, }; short yydefred[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 5, 6, 8, 7, 9, 11, 10, 12, 13, 14, 15, 17, 16, 18, 20, 19, 21, 23, 2, }; short yydgoto[] = { 1, 17, 38, }; short yysindex[] = { 0, -257, -249, -248, -247, -246, -258, -245, -256, -243, -242, -241, -240, -254, -239, -252, -238, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; short yyrindex[] = { 0, 25, 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, }; short yygindex[] = { 0, 0, 0, }; #define YYTABLESIZE 35 short yytable[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 22, 23, 25, 26, 31, 32, 34, 35, 18, 19, 20, 21, 37, 24, 27, 28, 29, 30, 33, 36, 22, }; short yycheck[] = { 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 273, 274, 273, 274, 273, 274, 273, 274, 272, 272, 272, 272, 10, 273, 272, 272, 272, 272, 272, 272, 10, }; #define YYFINAL 1 #ifndef YYDEBUG #define YYDEBUG 0 #endif #define YYMAXTOKEN 274 #if YYDEBUG char *yyname[] = { "end-of-file",0,0,0,0,0,0,0,0,0,"'\\n'",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,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,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,"BASE","ENTRY","SIZE", "OFFSET","DEVICE","OPTIONS","IMAGE","R0","R1","R2","R3","EXEC","BAUD", "OTHERFILE","OTHERBASE","NUMBER","WORD","PATH", }; char *yyrule[] = { "$accept : statements", "statements :", "statements : statements statement newline", "statement : BASE NUMBER", "statement : ENTRY NUMBER", "statement : SIZE NUMBER", "statement : OFFSET NUMBER", "statement : DEVICE PATH", "statement : DEVICE WORD", "statement : OPTIONS WORD", "statement : IMAGE PATH", "statement : IMAGE WORD", "statement : R0 NUMBER", "statement : R1 NUMBER", "statement : R2 NUMBER", "statement : R3 NUMBER", "statement : EXEC PATH", "statement : EXEC WORD", "statement : BAUD NUMBER", "statement : OTHERFILE PATH", "statement : OTHERFILE WORD", "statement : OTHERBASE NUMBER", "statement :", "newline : '\\n'", }; #endif #ifdef YYSTACKSIZE #undef YYMAXDEPTH #define YYMAXDEPTH YYSTACKSIZE #else #ifdef YYMAXDEPTH #define YYSTACKSIZE YYMAXDEPTH #else #define YYSTACKSIZE 500 #define YYMAXDEPTH 500 #endif #endif int yydebug; int yynerrs; int yyerrflag; int yychar; short *yyssp; YYSTYPE *yyvsp; YYSTYPE yyval; YYSTYPE yylval; short yyss[YYSTACKSIZE]; YYSTYPE yyvs[YYSTACKSIZE]; #define yystacksize YYSTACKSIZE #line 93 "gram.y" void yyerror(s) const char *s; { fprintf(stderr, "%s at %d", s, currentline()); exit(1); } #line 168 "y.tab.c" #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept #define YYERROR goto yyerrlab int yyparse() { register int yym, yyn, yystate; #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("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif } if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yychar) { #if YYDEBUG if (yydebug) printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, 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; #endif yynewerror: yyerror("syntax error"); #ifdef lint goto yyerrlab; #endif yyerrlab: ++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("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *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("%sdebug: error recovery discarding state %d\n", YYPREFIX, *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("%sdebug: state %d, error recovery discards token %d (%s)\n", YYPREFIX, yystate, yychar, yys); } #endif yychar = (-1); goto yyloop; } yyreduce: #if YYDEBUG if (yydebug) printf("%sdebug: state %d, reducing by rule %d (%s)\n", YYPREFIX, yystate, yyn, yyrule[yyn]); #endif yym = yylen[yyn]; yyval = yyvsp[1-yym]; switch (yyn) { case 3: #line 68 "gram.y" { boot_options.base_address = yyvsp[0].val; } break; case 4: #line 69 "gram.y" { boot_options.entry_address = yyvsp[0].val;} break; case 5: #line 70 "gram.y" { boot_options.image_size = yyvsp[0].val;} break; case 6: #line 71 "gram.y" { boot_options.image_offset = yyvsp[0].val;} break; case 7: #line 72 "gram.y" { boot_options.serial_device = yyvsp[0].str;} break; case 8: #line 73 "gram.y" { boot_options.serial_device = yyvsp[0].str;} break; case 9: #line 74 "gram.y" { boot_options.serial_options = yyvsp[0].str;} break; case 10: #line 75 "gram.y" { boot_options.image_file = yyvsp[0].str;} break; case 11: #line 76 "gram.y" { boot_options.image_file = yyvsp[0].str;} break; case 12: #line 77 "gram.y" { boot_options.regs[0] = yyvsp[0].val;} break; case 13: #line 78 "gram.y" { boot_options.regs[1] = yyvsp[0].val;} break; case 14: #line 79 "gram.y" { boot_options.regs[2] = yyvsp[0].val;} break; case 15: #line 80 "gram.y" { boot_options.regs[3] = yyvsp[0].val;} break; case 16: #line 81 "gram.y" { boot_options.exec = yyvsp[0].str;} break; case 17: #line 82 "gram.y" { boot_options.exec = yyvsp[0].str;} break; case 18: #line 83 "gram.y" { boot_options.baud_rate = yyvsp[0].val;} break; case 19: #line 84 "gram.y" { boot_options.o_image_file = yyvsp[0].str;} break; case 20: #line 85 "gram.y" { boot_options.o_image_file = yyvsp[0].str;} break; case 21: #line 86 "gram.y" { boot_options.o_base_address = yyvsp[0].val; } break; #line 385 "y.tab.c" } yyssp -= yym; yystate = *yyssp; yyvsp -= yym; yym = yylhs[yyn]; if (yystate == 0 && yym == 0) { #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state 0 to\ state %d\n", YYPREFIX, YYFINAL); #endif yystate = YYFINAL; *++yyssp = YYFINAL; *++yyvsp = yyval; 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("%sdebug: state %d, reading %d (%s)\n", YYPREFIX, YYFINAL, yychar, yys); } #endif } if (yychar == 0) goto yyaccept; goto yyloop; } if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && yyn <= YYTABLESIZE && yycheck[yyn] == yystate) yystate = yytable[yyn]; else yystate = yydgoto[yym]; #if YYDEBUG if (yydebug) printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yyssp, yystate); #endif if (yyssp >= yyss + yystacksize - 1) { goto yyoverflow; } *++yyssp = yystate; *++yyvsp = yyval; goto yyloop; yyoverflow: yyerror("yacc stack overflow"); yyabort: return (1); yyaccept: return (0); }