Your question is rather out of context, so it is hard to give an answer.
There is a Yacc-like grammar for C++, you might look at that one:
http://www.parashift.com/c++-faq-lite/compiler-
dependencies.html#faq-38.11
Otherwise, you might check out the Usenet newsgroup comp.compilers,
and its FAQ, published there monthly.
Hans Aberg
On 3 Aug 2006, at 09:36, 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?
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison