This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Precompiled headers (or other speed ups)
- To: zackw at stanford dot edu (Zack Weinberg)
- Subject: Re: Precompiled headers (or other speed ups)
- From: Joe Buck <jbuck at racerx dot synopsys dot com>
- Date: Wed, 10 Jan 2001 15:23:04 -0800 (PST)
- Cc: dkorn at pixelpower dot com (David Korn), dewar at gnat dot com ('dewar at gnat dot com'), gcc at gcc dot gnu dot org
Zack Weinberg writes:
> C++ reads files through cpplib, which is naturally as fast as I and
> Neil Booth have been able to make it...
>
> The parser, on the other hand, is not efficient at all...
>
> I don't know enough about C++ or its implementation in GCC to say for
> sure what the ultimate cause is. I've been told that C++ has an
> extremely ambiguous grammar and the parser has to accumulate entire
> statements on the stack before it can begin to match anything.
It is true that the C++ grammar is ugly, but it is not nearly as ugly as
gcc/cp/parse.y is. The bison grammar has had about 10 years worth of
changes applied to track a rapidly evolving language, and it contains many
expensive kludges that no one dares touch. Mark Mitchell's been talking
about pitching the whole thing and redoing it (after 3.0).