This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc compile-time performance


>>>>> "Robert" == Robert Dewar <dewar@gnat.com> writes:

Robert> Requiring LALR(1) is indeed an annoying restriction (one we
Robert> avoid in GNAT, partly because it causes some distortion of the
Robert> grammar, and we prefer to use exactly the grammar in the RM,
Robert> even though it is ambiguous).

Very much agreed.  Actually, even with plain LALR(1) I believe that
Bison can help GCC with faster parsers.  For instance, there are a
couple of unit rules in these grammars (a -> b), which can be rather
costly.  Although, it might be interesting to experiment with
non-compressed tables: they will be somewhat bigger, but maybe some
performance is to be gained.  Some products out there offer the
alternative (compressed or not).

[...]

Robert> To me by the way, deciding to use a tool like BISON is tying
Robert> your hands behind your back before you start :-) 

Are you referring to use *any* tool as opposed to hand-written
parsers, or specifically Yaccs?

Robert> In particular, there is nothing terrible about a little bit of
Robert> backup here and there, just so long as you don't get anything
Robert> that's exponential or takes noticeable time.

As I said, Bison will have GLR, which is superior to backtracking.
And in addition, in a later release, I plan to swallow BTYacc into
Bison, as its current framework aims at unifying all these variation
around LALR.

Robert> I also find the syntax error messages from these BISON parsers
Robert> terrible.

Well, we are ready to improve them!  Just state precisely what the
problem is!  Personally, I fund them quite good as compared to other
tools, but there is certainly room for improvement.  As an example,
here is what Bison (alone, without any help from the writer) reports:

src/tiger/src % echo "1 ++ 1" | ./tc -l -
standard input:1.4: parse error, unexpected "+"
src/tiger/src % echo "for i = 1 to 10 do i" | ./tc -l -
standard input:1.7: parse error, unexpected "=", expecting ":="
src/tiger/src % echo 'let in 1' | ./tc -l -
standard input:2.1-0: parse error, unexpected "end of file", expecting ";"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]