This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++, libstdc++-v3 and, well, error messages



> Just a quick note here. It is far from obvious that recursive descent
> parsers allow better error diagnostics and error recovery than table
> driven LR parsers.

For languages that are LALR(1), I fully agree.  C++ is not such a
language.  Parsing C++ with a bison parser requires all kinds of
ugly hacks (g++ currently does it by an extra pass that sits between
the lexer and the parser, the purpose of which is to do the needed
extra lookahead).
 
> By the way, in accordance with the normal terminology in the compiler world,
> I use "parser" to mean solely the phase of the compiler that generates a
> syntactic tree, and I exclude the semantics analysis

It is difficult to achieve this syntax/semantics separation in C++,
because of cases where constructor calls and function declarations are
syntactically identical, and because parsing depends on whether names
are types or not.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]