LL(1) C grammar
Dr. Jon Mauney
mauney at eos.ncsu.edu
Tue Jun 18 23:58:26 AEST 1991
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
--
Send compilers articles to compilers at iecc.cambridge.ma.us or
{ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.
More information about the Comp.lang.c
mailing list