Xref: utzoo comp.lang.c:40243 comp.compilers:2095 Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!world!iecc!compilers-sender From: mauney@eos.ncsu.edu (Dr. Jon Mauney) Newsgroups: comp.lang.c,comp.compilers Subject: Re: LL(1) C grammar Keywords: C, parse, LL(1) Message-ID: <91-06-025@comp.compilers> Date: 18 Jun 91 13:58:26 GMT Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: mauney@eos.ncsu.edu (Dr. Jon Mauney) Organization: North Carolina State University Lines: 20 Approved: compilers@iecc.cambridge.ma.us 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@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.