Dong Tiger wrote:
Look at the following expression( c-like syntax):

      1 - 2 * (TYPE_OR_VAR) - 1

The real token type of TYPE_OR_VAR is unknown. The expression could be
parsed as the following two options:

1. TYPE_OR_VAR is a typename. Then "(TYPE_OR_VAR)-1" is a cast expression.
And the expression equals to:
     1 - ( 2 * ( (TYPE_OR_VAR)-1))

2. TYPE_OR_VAR is a variable. Then the expression equals to:
     1 - 2 * TYPE_OR_VAR - 1

I would like to choose the second option but I can't do it with "%dprec". As
when the ambiguity happens, the two options
are shifted by the same rule.

What can I do to get around this problem?

Your lexer could lookup your symbol table and return TYPE in one case and VAR in the other.

--
  Sylvain


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

Reply via email to