From: Shigeru C. <ch...@is...> - 2004-07-20 14:09:36
|
Hi, Just a short comment. From: Stefan Seefeld <se...@sy...> Date: Sun, 18 Jul 2004 11:00:48 -0400 > > So, Environment does not know about Int or IntVector until the parsing > > of the whole namespace ends. > > well, but as we just discovered, this doesn't work for C++ in general where > certain ambiguities have to be resolved using the knowledge about previously > declared types, variables, etc. Yes, but maintaining the table of type and template names is really complicated. For example, the parser must be able to recognize Link as a type name in this code snippet: typedef struct { Link* next; int value; } Link; (sorry if the syntax above is wrong. I haven't written C++ code for years. :<) So my solution was to avoid maintaining such a table. Instead, the parser tries to parse given code in different ways till it gets a syntax tree without errors. So the parser does a lot of backtracking. However, I'm not sure that this approach still works with the current specifications of C++. Remember that C++ had not supported templates yet when I wrote the parser. Chiba |