C++, libstdc++-v3 and, well, error messages
Joe Buck
jbuck@racerx.synopsys.com
Sat Nov 18 14:49:00 GMT 2000
> 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.
More information about the Gcc
mailing list