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

[OCLUG-Tech] Re: Linux Digest, Vol 9, Issue 15

> From: William Case <billlinux [ at ] rogers [ dot ] com>
> Subject: Re: [OCLUG-Tech] Re: Parsing when compiling C - generalized
>         understanding question?
> To: "Brenda J. Butler" <bjb [ at ] istop [ dot ] com>
> Cc: OCLUG Technical <linux [ at ] lists [ dot ] oclug [ dot ] on [ dot ] ca>
> Message-ID: <1128039732.32672.132.camel@CASE>
> Content-Type: text/plain
> I am going to take you at your word and ask the following questions
> about compiling.
> OK, here goes!

Your questions are of a very specific nature which I will leave to the
linux people.
Though you claim to want to know about parsing, most of your questions
relate to
other aspects of compiling.  If you want an overall picture of what's
involved with
compiling the first chapter of the Dragon book is quite good.  The
rest of the Dragon
book is very good if your prepared to put in a lot of work.  Other books might
be better for a less deep understanding (which I think is what you want) but
unfortunately I cannot recommend one.

Parsing/Lexical analysis is what I know best so allow me to make the following

Parsing/Lexical analysis is the simplist part of compiling.  After
that it gets harder
and the back end gets very hard once you start looking at optimization.
Parsing and Lexical analysis are also useful for other things than
compiling so I
view them as where to start with compiler construction (after getting
an overview).
The easiest kind of parsing is recursive descent (RC).  You MUST understand RC
before trying any other parsing methods.  RC is also a lot of fun once you get
the hang of it.
I am a big believer in using parsing generator tools for parsing
(after you know RC).
Rather than Lex/Yacc I recommend Antlr.  Antlr is RC based and generates
code (C, C++, Java; your choice) that you can look at.  This is very useful
for understanding and debugging.  Yacc, by contrast, generates tables
which are incomprehensible.
Antler has a steep learning curve unfortunately but it is still much
better than the
other tools I have seen.

You can always wait until my parsing tool comes out but that may take a while.

Ralph (Rocky) Boland