Dong Tiger,
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?
Use %merge
I had exactly the same problem with my C grammar and solved
it this way.
-
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: