3 %parse-param { int regs[26]
4 %parse-param { int *base
14 #define YYLEX_PARAM base
15 #define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
16 #define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
18 static void YYERROR_DECL();
31 %left UMINUS /* supplies precedence for unary minus */
33 %% /* beginning of rules section */
63 | '-' expr %prec UMINUS
71 { $$ = $1; (*base) = ($1==0) ? 8 : 10; }
73 { $$ = (*base) * $1 + $2; }
76 %% /* start of programs */
79 extern int YYLEX_DECL();
94 #define UNUSED(x) ((void)(x))
99 UNUSED(regs); /* %parse-param regs is not actually used here */
100 UNUSED(base); /* %parse-param base is not actually used here */
101 fprintf(stderr, "%s\n", s);
107 /* lexical analysis routine */
108 /* returns LETTER for a lower case letter, yylval = 0 through 25 */
109 /* return DIGIT for a digit, yylval = 0 through 9 */
110 /* all other characters are returned immediately */
114 while( (c=getchar()) == ' ' ) { /* skip blanks */ }
116 /* c is now nonblank */
123 *yylval = (c - '0') % (*base);