1 %parse-param { int regs[26] }
2 %parse-param { int *base }
4 %lex-param { int *base }
11 #define YYLEX_PARAM base
12 #define YYLEX_DECL() yylex(int *YYLEX_PARAM)
13 #define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
15 static void YYERROR_DECL();
28 %left UMINUS /* supplies precedence for unary minus */
30 %% /* beginning of rules section */
60 | '-' expr %prec UMINUS
68 { $$ = $1; (*base) = ($1==0) ? 8 : 10; }
70 { $$ = (*base) * $1 + $2; }
73 %% /* start of programs */
76 extern int YYLEX_DECL();
94 fprintf(stderr, "%s\n", s);
100 /* lexical analysis routine */
101 /* returns LETTER for a lower case letter, yylval = 0 through 25 */
102 /* return DIGIT for a digit, yylval = 0 through 9 */
103 /* all other characters are returned immediately */
107 while( (c=getchar()) == ' ' ) { /* skip blanks */ }
109 /* c is now nonblank */
116 yylval = (c - '0') % (*base);