Hello,

I was debugging shift/reduce conflicts in a grammar and tracked
down the problem to a typo. I had misspelled a token name in a
%prec directive. The misspelled token name was an undefined token.
Like so:

%token INT
%left '-'
%left UMINUS

%%

expr: term
    | expr '-' expr
    | '-' expr %prec UNINUS
    ;

term: INT
    | '(' expr ')'
    ;

bison 2.4.1 was silent about it even with --warnings=all

It would be consistent to issue an error about this situation.
After all one cannot use an undefined token elsewhere in a rule.
So why should this be allowed in %prec?

        Florian



Reply via email to