>>> "MK" == Matthias Kramm <[EMAIL PROTECTED]> writes:

 > state 1
 >     4 EXPRESSION: T_IDENTIFIER . '(' EXPRESSION ')'
 >     5           | T_IDENTIFIER .  [$end, T_IDENTIFIER, ';', '(', ')', "++", 
 > "--", '+', '-', '/']
 >     '('  shift, and go to state 5
 >     '('       [reduce using rule 5 (EXPRESSION)]
 >     $default   reduce using rule 5 (EXPRESSION)

 > Is there some way to tell bison to prefer shifting to reducing in this
 > case? 

Yes, sure.  S/R is a conflict bw a rule (reduce) and a token (shift).
Since you want the shift here, the token must have precedence over the
rule (or both have the same precedence but right associativity).

The rule is labeled by T_IDENTIFIER, so you can just state that

    %nonassoc T_IDENTIFIER
    %nonassoc '('

to get what you want, use use %prec to label the rule with some other
precedence/associativity token.


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to