help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to solve this kind of ambiguities?


From: Dong Tiger
Subject: How to solve this kind of ambiguities?
Date: Thu, 3 Aug 2006 15:36:30 +0800

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]