1 %parse-param { int regs[26] }
2 %parse-param { int *base }
4 %lex-param { int *base }
20 %left UMINUS /* supplies precedence for unary minus */
22 %% /* beginning of rules section */
52 | '-' expr %prec UMINUS
60 { $$ = $1; (*base) = ($1==0) ? 8 : 10; }
62 { $$ = (*base) * $1 + $2; }
65 %% /* start of programs */
82 fprintf(stderr, "%s\n", s);
88 /* lexical analysis routine */
89 /* returns LETTER for a lower case letter, yylval = 0 through 25 */
90 /* return DIGIT for a digit, yylval = 0 through 9 */
91 /* all other characters are returned immediately */
95 while( (c=getchar()) == ' ' ) { /* skip blanks */ }
97 /* c is now nonblank */
104 yylval = (c - '0') % (*base);