Re: Looking for the GNU gcc grammar

tmk@netvision.net.il (Michael Tiomkin)
27 Apr 2003 02:09:05 -0400

          From comp.compilers

Related articles
Looking for the GNU gcc grammar foolishewe@hotmail.com (2003-04-13)
Re: Looking for the GNU gcc grammar foolishewe@hotmail.com (2003-04-15)
Re: Looking for the GNU gcc grammar dberlin@dberlin.org (Daniel Berlin) (2003-04-15)
Re: Looking for the GNU gcc grammar rossb@audiomulch.com (Ross Bencina) (2003-04-20)
Re: Looking for the GNU gcc grammar tmk@netvision.net.il (2003-04-27)
| List of all articles for this month |
From: tmk@netvision.net.il (Michael Tiomkin)
Newsgroups: comp.compilers
Date: 27 Apr 2003 02:09:05 -0400
Organization: http://groups.google.com/
References: 03-04-044 03-04-051
Keywords: parse, tools
Posted-Date: 27 Apr 2003 02:09:05 EDT

foolishewe@hotmail.com (Bill Last Name Omitted) wrote in message news:03-04-051...
...
> After some preliminary source diving, I've found the expected Bison
> file which recognizes the nonterminals. However, I was surprised that
> I did not find a flex based scanner (it looks like they use ad hoc
> lexical analysis). Anyone know why they don't use flex for scanning?


    The reason of not using lex is compiler performance.
Usually, a compiler spends most of compile time in lexical analyzer,
and the easiest way to improve performance is to change the tokenizer.
    You are lucky that the C (and even gcc) keywords are simple and
well-known, and it is a relatively easy job to recover them.
    BTW, you can remove the typedef hack from the lexer and place it
in the parser (where it should belong if you want a decent grammar).


    Michael


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.