9 static void yyerror(const char *s);
28 %left UMINUS /* supplies precedence for unary minus */
30 %% /* beginning of rules section */
60 | "SUB" expr %prec UMINUS
68 { $$ = $1; base = ($1==0) ? 8 : 10; }
70 { $$ = base * $1 + $2; }
73 %% /* start of programs */
85 yyerror(const char *s)
87 fprintf(stderr, "%s\n", s);
92 /* lexical analysis routine */
93 /* returns LETTER for a lower case letter, yylval = 0 through 25 */
94 /* return DIGIT for a digit, yylval = 0 through 9 */
95 /* all other characters are returned immediately */
99 while( (c=getchar()) == ' ' ) { /* skip blanks */ }
101 /* c is now nonblank */