This is the mail archive of the
mailing list for the GCC project.
Re: gcc compile-time performance
- From: Akim Demaille <akim at epita dot fr>
- To: dewar at gnat dot com (Robert Dewar)
- Cc: gcc at gcc dot gnu dot org, Bison Help <help-bison at gnu dot org>
- Date: 20 May 2002 14:53:55 +0200
- Subject: Re: gcc compile-time performance
- References: <20020520122958.D6290F28C4@nile.gnat.com>
>>>>> "Robert" == Robert Dewar <firstname.lastname@example.org> 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
Robert> I also find the syntax error messages from these BISON parsers
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 ";"