This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++, libstdc++-v3 and, well, error messages
- To: Joe Buck <jbuck at racerx dot synopsys dot com>
- Subject: Re: C++, libstdc++-v3 and, well, error messages
- From: Neil Booth <neilb at earthling dot net>
- Date: Sat, 18 Nov 2000 23:32:52 +0000
- Cc: Robert Dewar <dewar at gnat dot com>, Gabriel dot Dos_Reis at sophia dot inria dot fr,pfeifer at dbai dot tuwien dot ac dot at, gcc at gcc dot gnu dot org
- References: <20001118133423.8CD4334D80@nile.gnat.com> <200011182247.OAA14920@racerx.synopsys.com>
Joe Buck wrote:-
> 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).
With the macro rewrite, in cpplib I implemented a feature where the
client can mark a spot in the token stream, and continue to get
tokens. Some time in the future the client drops the mark; with the
option of returning to the marked spot (in which case getting tokens
repeats the delineated tokens), or to continue without returning. The
client can even nest these marks, as long as they're popped LIFO
style.
If this were used in the existing C++ parser, it would probably make
it a lot cleaner. I don't know whether the new recursive decent
parser will care, but I imagine it could be useful.
Neil.