Re: Looking for the GNU gcc grammar

foolishewe@hotmail.com (Bill Last Name Omitted)
15 Apr 2003 00:17:21 -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: foolishewe@hotmail.com (Bill Last Name Omitted)
Newsgroups: comp.compilers
Date: 15 Apr 2003 00:17:21 -0400
Organization: http://groups.google.com/
References: 03-04-044
Keywords: GCC, C
Posted-Date: 15 Apr 2003 00:17:21 EDT

foolishewe@hotmail.com (Bill Last Name Omitted) wrote


> Does anyone know if the GCC people (or someone else) publishes the
> actual grammar accepted by GCC? I've seen references to extensions to
> the ANSI grammar in the online documentation but have yet to see a
> consolidated description of the grammar (unless I want to go read
> compiler source code I guess), so any links would be appreciated. In
> fact it might be nice if the GCC info file actually included a grammar
> description (much like the K&R books did, it is useful when using a
> compiler to know its grammar).
> [I've never seen it other than the bison source. -John]


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?
Also, the grammar in Bison source code is more complex than that given
in K&R, and probably not as intuitive as the simpler K&R grammar
(perhaps in part due to objective C support?).


Does anyone know how to map lexemes to terminals for GCC? Sorry to
trouble you again, but if I'm right and they use an ad hoc scanner, it
will be slow to figure out what it does (so I might just skip it).


Thanks:


Bill M.


Post a followup to this message

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