Re: gcc parser

Michael Meissner <>
2 Nov 1999 00:40:00 -0500

          From comp.compilers

Related articles
gcc parser (Addam Schroll) (1999-10-27)
Re: gcc parser (Tim Josling) (1999-10-31)
Re: gcc parser (Michael Meissner) (1999-11-02)
| List of all articles for this month |

From: Michael Meissner <>
Newsgroups: comp.compilers
Date: 2 Nov 1999 00:40:00 -0500
Organization: Cygnus Solutions
References: 99-10-129
Keywords: C, parse, GCC

Addam Schroll <> writes:

> I want to use the gcc parser for my own purposes to speed up
> development on a little project I've been working on. Basically, I
> want to add my own actions to the gcc parser so I get the behavior I
> want. This is my first endeavor into gcc and I was wondering if
> anyone could give me a few links that might help me understand the gcc
> parser code and point me in a good direction to get the source (other
> than downloading all of gcc itself if possible). I'd appreiciate any
> help.

The parser itself is written in Bison, which borrows its syntax from
YACC (yet another compiler compiler from the PWB/v7 unix releases).
The bison source release contains all of the documentation and you can
buy the hardcopy of the manual from the Free Software Foundation (or
many technical bookstores). Likewise, the GCC manual includes a
section on porting and internals, though like most complex software
projects, the internals documentation could be vastly improved upon.

However, the parser itself is a small fraction of the whole compiler.
You will need the full source in order to modify the parser. If you
have purchased a full Linux release (such as RedHat), it contains the
full source to the compiler (RedHat/Mandrake/SUSE put the sources in a
source cd stored within rpm files). You can also purchase a copy from
cdrom vendors fairly cheaply that contain the GCC sources (ideally if
you go the purchase route, you should purchase from a vendor that
contributes part of the fee back to the Free Software Foundation).

Do take a moment to look at the license if you plan to ever distribute
the modified compiler.

Out of curiousity, what exactly do you want to do? You might want to
hook up with the various GCC mailing lists
( to better ask questions,

Oh, and by the way, have fun!
Michael Meissner, Cygnus Solutions
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886
email: phone: 978-486-9304 fax: 978-692-4482

Post a followup to this message

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