Re: Looking for a LL version of C grammar (VBDis)
2 Mar 2004 11:08:46 -0500

          From comp.compilers

Related articles
Looking for a LL version of C grammar (2004-02-26)
Re: Looking for a LL version of C grammar (Isaac) (2004-02-27)
Re: Looking for a LL version of C grammar (2004-03-02)
Re: Looking for a LL version of C grammar (dtf) (2004-03-11)
| List of all articles for this month |

From: (VBDis)
Newsgroups: comp.compilers
Date: 2 Mar 2004 11:08:46 -0500
Organization: AOL Bertelsmann Online GmbH & Co. KG
References: 04-02-145
Keywords: C, parse
Posted-Date: 02 Mar 2004 11:08:46 EST schreibt:

>So based on some internet search and dragon book, I tried to convert
>the LALR to LL using left recursion removal and left factoring with no
>avail. The situation became kind of nightmare due to , hmm..., you
>know, the first/follow problem and I'm not really sure this is the way
>to go.

Recently I've handcrafted an top-down parser for C, based on some
available informal grammars. It took about one day to implement the
parser, with much lookahead or backtracking so far. But it took much
more time to implement just the semantics for the declarations, and I
had to modify the grammar and the parser in some places, because some
header files contained strange aberrations even from the language

> (I'm not a compiler expert and am just doing this as my hobby.)

Perhaps you should play some time with CoCo/R or similar RDP
generator. It has helped me a lot in understanding how a grammar can
be translated into parser code. But I also found it a waste of time to
tweak grammars for some stupid parser generator, in detail for
languages like C, which turn out to be context sensitive at a second
glance. I'd rather accept some error messages from the parser
generator, and correct the created code in the indicated places

BTW, the source code of an alpha version of my C
scanner/preprocessor/parser is available from
if you have use for Object Pascal (Delphi) code.

This project is still under construction, the parser currently only
accepts declarations and skips procedure definitions (compound


Post a followup to this message

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