help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcc compile-time performance


From: Joe Buck
Subject: Re: gcc compile-time performance
Date: Mon, 20 May 2002 18:40:03 -0700 (PDT)

> <<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).
> >>
> 
> Certainly one should do nearest spelling error correction in such cases, that
> can definitely help. 

The "right" way to do it if you have a hand-written parser is to try to
go forward under more than one assumption: either the undefined name is
an identifier, or it is a type.  Picking the wrong assumption will
generate a cascade of errors; picking the right assumption will only
generate one or two.  We actually added a couple of simple rules of this
type around the 3.0 timeframe, e.g. for "foo bar;" where foo is
undeclared, assumes that foo is a type, so bar gets marked as a value
whose type is {error}.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]