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 */
77 fprintf
(stderr
, "%s\n", s
);
81 yylex() { /* lexical analysis routine */
82 /* returns LETTER for a lower case letter, yylval = 0 through 25 */
83 /* return DIGIT for a digit, yylval = 0 through 9 */
84 /* all other characters are returned immediately */
88 while
( (c
=getchar
()) == ' ' ) { /* skip blanks */ }
90 /* c is now nonblank */