From: | "Ivan A. Kosarev" <ik@unicals.com> |
Newsgroups: | comp.compilers |
Date: | 19 Dec 2006 01:05:56 -0500 |
Organization: | Unicals Group |
References: | 06-09-029 06-09-042 06-09-048 06-09-060 06-09-078 06-09-093 06-12-064 06-12-066 |
Keywords: | C, parse |
Posted-Date: | 19 Dec 2006 01:05:56 EST |
Robert A Duff wrote:
> The typical solution in Ada compilers is for the parser to build a
> tree that means "this could be any of ...", with X and Y as subtrees,
> and then semantic analysis has symbol tables, so it knows what X is,
> and changes that node into a "function call" or "array indexing" or
> whatever is appropriate. (Note: X could be an overloaded name.)
>
> My question is: can that technique work for the above C and C++
> ambiguities?
What benefits you would like with this technique?
> Does it make the problem easier or harder? Is the answer different
> for C++ than for C?
Well, in C it's just not a great problem to determine whether current
identifier is a typedef name, so it's hard to me to see what we would have
from passing that choice to a late phase. That approach would be reasonable
for some precompiling techniques like precompiled headers, but there are
other issues with the preprocessing phase in both C and C++.
In C++, there are too many disambiguation variants possible to track them
all into representation trees.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.