Hi David,
David PONCE <david.ponce@...> writes:
>> Under what circumstances can a rule that is part of a grammar be
>> eliminated like this?
>
> It's difficult to say without viewing the whole grammar. However,
> based on what I saw in the Java grammar, I wonder if the
> `unary_expr_not_minus' definition shouldn't rather be something like
> this:
>
> unary_expr_not_minus : NOT expr
> | TILDE expr
> | LBRACK_RBRACK expr
> | LT_GT expr
> ;
Actually, that is how it was orginally defined, but that just
introduces even more ambiguity. I tried the odd unary-centric version
simply because wisent-java.wy does it that way on a lark.
> Probably you will have to thoroughly analyze the automaton produced
> from you grammar (M-x wisent-toggle-verbose-flag before compiling your
> grammar).
The problem is that the automaton simply does not reference the rules
at all, they are tagged as useless.
> Perhaps reading "Understanding the automaton" in the Wisent's manual,
> and looking at the Bison's manual could be useful too.
I'll reread it, but I've never seen Bison drop rules before.
I'll work on it some more.... thanks for the data.
Joe
|