home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] Re: Parsing when compiling C - generalized understanding question?

  • Subject: Re: [OCLUG-Tech] Re: Parsing when compiling C - generalized understanding question?
  • From: "Brenda J. Butler" <bjb [ at ] istop [ dot ] com>
  • Date: Thu, 29 Sep 2005 13:28:18 -0400
On Thu, Sep 29, 2005 at 01:05:17PM -0400, Martin Hicks wrote:
> 
> On Thu, Sep 29, 2005 at 12:24:45PM -0400, William Case wrote:
> > Hi;
> > 
> > I've done my homework; read the info, RedHat Manuals, googled and
> > searched Wikipedia regarding the gcc compiler.  I have gotten most of
> > the overview that I wanted.  However, I have one question that wasn't
> > answered, or if answered, I missed its importance.
> > 
> > I am trying to develop an overview understanding of what happens when
> > parsing any little C program I have written.  Where would I find the
> > rules that the parser uses to translate specific symbols?  For example,
> > I would like to see exactly what happens with the "{ }" braces or the
> > ";" semi-colon when translated from source code to object code or
> > binary.  But my question is not only about those two symbols alone.  I

Well, the gcc is the Gnu Compiler Collection.  It has front ends for reading
and parsing programs (a front end for each language), back ends for spitting
out machine code (a back end for each architecture/os), and a middle section
that connects the front end and back end and does optimization.

The middle section deals with the code in a language- and machine-independent
format.

So, you won't see the gcc compiler converting a { into machine or
binary code.

Have fun with that :-)

...

> Wow.  So this isn't just an easy question that someone can answer.  What
> happens during parsing of a source language?  Lots.  Far too much to try
> to explain, but here's a little summary of stuff you should go look
> into.

> > I have a couple of other short dumb questions about compiling. If
> > someone is willing to answer them they can email me directly and I will
> > send them to you?  I just think they might be boring for the people on
> > this list, and embarrassingly stupid for me.  To be honest, most of
> > these questions I could probably sort out for myself but I have already
> > spent more than a day on getting a compiling overview and a little help
> > would be gratefully received.
> 
> Ask the list.  If dumb questions get answered once then maybe, just
> maybe, the next person who wants to ask the same dumb question will
> search the archives first.

I agree.  We don't usually find your questions dumb anyway, often
they seem simple but spark some interesting discussions.

So if you finally do ask a dumb one, you've earned the right :-)

cheerio,
bjb