This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gcc compile-time performance
- From: Hans Aberg <haberg at matematik dot su dot se>
- To: dewar at gnat dot com (Robert Dewar)
- Cc: gcc at gcc dot gnu dot org, help-bison at gnu dot org
- Date: Mon, 20 May 2002 23:01:59 +0200
- Subject: Re: gcc compile-time performance
At 12:38 -0400 2002/05/20, Robert Dewar wrote:
>Compilers can do MUCH better than people think.
Yes, but if the language depends on a lot of structured context
information, that isn't easy.
>A lot depends on the behavior of the compiler.
So it depends on the language as well.
>As an example, if you see an end or } that is malformed or unexpected, then
>it is quite important to try to figure out the structure. This is much harder
>in C++ than in Ada, but not impossible.
The problem in C++ is that if one say mistypes say a class name in its
definition, a lot of subsequent code becomes meaningless to the compiler to
catch: The context information that it is a class name is lost. Catching a
missed "}" is a relatively simple problem to that as the meaning of "{"
does not change with context (like the language type that a name belongs
to).
>A lot of people are used to the kind of error messages that come from fairly
>naive bottom up automatic parsers like YACC. You can do a *LOT* better than
>this if you take the effort.
I don't think it has to do with the bottom-up parsing algorithms itself,
but the question how to develop a general theory that can take care of
context and semantic information and feed that into the error handling
system of the generated parser. -- The Berkeley folks seems to do some
research on that.
Hans Aberg