Re: C and LL (1)

frigot_e@epita.fr (frigot eric)
27 Oct 2001 18:39:08 -0400

          From comp.compilers

Related articles
C and LL (1) pjbp@netc.pt (Pedro Pereira) (2001-10-23)
Re: C and LL (1) loewis@informatik.hu-berlin.de (Martin von Loewis) (2001-10-27)
Re: C and LL (1) andrew@blueoffice.com (Andrew Wilson) (2001-10-27)
Re: C and LL (1) frigot_e@epita.fr (2001-10-27)
Re: C and LL (1) loewis@informatik.hu-berlin.de (Martin von Loewis) (2001-10-28)
Re: C and LL (1) dr_feriozi@prodigy.net (2001-11-04)
Re: C and LL (1) GOLDParser@DevinCook.com (2001-11-05)
Re: C and LL (1) gzw@home.com (Geoff Wozniak) (2001-11-08)
Re: C and LL (1) joachim_d@gmx.de (Joachim Durchholz) (2001-11-11)
| List of all articles for this month |
From: frigot_e@epita.fr (frigot eric)
Newsgroups: comp.compilers
Date: 27 Oct 2001 18:39:08 -0400
Organization: http://groups.google.com/
References: 01-10-121
Keywords: C, LL(1)
Posted-Date: 27 Oct 2001 18:39:08 EDT

Pedro Pereira <pjbp@netc.pt> wrote in message news:01-10-121...
> Hi,
>
> Can C be parsed by a LL (1) parser? I've serached in the web a lot,
> but i couldn't find the anwser!
>
> Thanks in advance,
> Pedro Pereira
> [Yes, give or take typedef. -John]


Hi,


I think you can't parse C with a LL(1) grammar because there is a lot
of ambiguity in C (30-40 shift reduce with Bison, for exemple).
For exemple, just look at the if statement definition :
if (expression) statement
OR
if (expression) statement else statement
I don't think you can parse that with LL(1) grammar.
You need to know if you've got the 'else' before reducing the if
statement.


Post a followup to this message

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