Re: How to solve this kind of ambiguities?

2006-08-06 Thread Dong Tiger
Actually, I am writing a code analyser which parses c/c++ code without doing the preprocess thing. So when I encounter an ambiguity, I just 'guess' which option is more proper. Symbol table, when I have time to write it, will be helpful to make the guess more accurate. At this moment, %

How to solve this kind of ambiguities?

2006-08-03 Thread Dong Tiger
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: