8 extern int yylex(void);
9 static void yyerror(const char *s);
21 %left UMINUS /* supplies precedence for unary minus */
23 %% /* beginning of rules section */
53 | '-' expr %prec UMINUS
61 { $$ = $1; base = ($1==0) ? 8 : 10; }
63 { $$ = base * $1 + $2; }
66 %% /* start of programs */
78 yyerror(const char *s)
80 fprintf(stderr, "%s\n", s);
86 /* lexical analysis routine */
87 /* returns LETTER for a lower case letter, yylval = 0 through 25 */
88 /* return DIGIT for a digit, yylval = 0 through 9 */
89 /* all other characters are returned immediately */
93 while( (c=getchar()) == ' ' ) { /* skip blanks */ }
95 /* c is now nonblank */