[antlr-interest] ambiguity
Adrian Sandor
aditsu at yahoo.com
Tue Jul 8 01:41:51 PDT 2003
I'm trying to parse C++ source code (for writing a formatter), and I
stumbled on a problem
take a look at this program:
//---snip
int f(int x){return x;}
typedef char c;
int main()
{
int x=5, y;
y=(f)(x);
y=(c)(x);
}
//---snip
it compiles ok, and look at the last 2 instructions: lexically they
are identical, but semantically the first one is a function call and
the second one is a cast
the question is.. how should I write the parser? should I still try
to distinguish the 2 instructions, or should I treat them the same
way sintactically? (for this project it could be ok)
thanks
Adrian
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list