Re: LL(1) C grammar

mauney@eos.ncsu.edu (Dr. Jon Mauney)
Tue, 18 Jun 1991 13:58:26 GMT

          From comp.compilers

Related articles
LL(1) C grammar jos@and.nl (1991-06-17)
Re: LL(1) C grammar mauney@eos.ncsu.edu (1991-06-18)
| List of all articles for this month |

Newsgroups: comp.lang.c,comp.compilers
From: mauney@eos.ncsu.edu (Dr. Jon Mauney)
Keywords: C, parse, LL(1)
Organization: North Carolina State University
Date: Tue, 18 Jun 1991 13:58:26 GMT

I have an LL(1) grammar for C. It is in the format accepted by my parser
generator (as described in Fischer and LeBlanc "Crafting a Compiler" It
should be easy to convert to any other format.


I don't use this grammar much, so I can't claim it's perfect. It does
have one place where I deliberately punted: the grammar will accept any
expression as a statement label. The problem is a common-prefix between
labels and expressions, and I was not willing to factor it up through 13
levels of operator precedence. If you collapse the expression grammar to
1 level of precedence, it should be easy to factor labels.


I'd be happy to mail it to you. Just send me a reply so I know I've got
your address correct.
--
Jon Mauney, parsing partisan
Computer Science Dept.
N.C. State University
--


Post a followup to this message

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