Re: LR(1) Parsing : Error Handling & Recovery

Chris Dodd <cdodd@acm.org>
Tue, 29 Jul 2014 19:38:48 +0000 (UTC)

          From comp.compilers

Related articles
[20 earlier articles]
Re: LR(1) Parsing : Error Handling & Recovery drikosev@otenet.gr (Evangelos Drikos) (2014-07-21)
Re: LR(1) Parsing : Error Handling & Recovery haberg-news@telia.com (Hans Aberg) (2014-07-21)
Re: LR(1) Parsing : Error Handling & Recovery wclodius@earthlink.net (2014-07-21)
Re: LR(1) Parsing : Error Handling & Recovery gneuner2@comcast.net (George Neuner) (2014-07-25)
Re: LR(1) Parsing : Error Handling & Recovery cdodd@acm.org (Chris Dodd) (2014-07-26)
Re: LR(1) Parsing : Error Handling & Recovery DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2014-07-28)
Re: LR(1) Parsing : Error Handling & Recovery cdodd@acm.org (Chris Dodd) (2014-07-29)
Re: LR(1) Parsing : Error Handling & Recovery monnier@iro.umontreal.ca (Stefan Monnier) (2014-08-06)
Re: LR(1) Parsing : Error Handling & Recovery drikosev@otenet.gr (Evangelos Drikos) (2014-08-26)
Re: LR(1) Parsing : Error Handling & Recovery haberg-news@telia.com (Hans Aberg) (2014-08-29)
Re: LR(1) Parsing : Error Handling & Recovery haberg-news@telia.com (Hans Aberg) (2014-09-03)
| List of all articles for this month |
From: Chris Dodd <cdodd@acm.org>
Newsgroups: comp.compilers
Date: Tue, 29 Jul 2014 19:38:48 +0000 (UTC)
Organization: A noiseless patient Spider
References: 14-07-023 14-07-024 14-07-030 14-07-031 14-07-041 14-07-046 14-07-060 14-07-062 14-07-063
Keywords: LL(1), parse
Posted-Date: 29 Jul 2014 15:42:18 EDT

Hans-Peter Diettrich <DrDiettrich1@netscape.net> wrote in
> Unfortunately I couldn't get the article, so here's what I don't understand:
>
>> is:
>>
>> S ::= aSA | \epsilon
>> A ::= aabS | c
>>
>> This grammar (and the language) is LL(2), but there does not exist an
>> equivalent LL(1) grammar.
>
> IMO this grammar is LL(3), not LL(2). There might be a typo in A, which
> might originally read as:
> A ::= abS | c
> resulting in an LL(2) grammar.


Yes, my fault for not carefully checking my post. As written, it's an
LL(3) grammar for a language that is not LL(2). Remove one 'a' from
the 'A' rule to get an LL(2) grammar for a language that is not LL(1).
Add 'a's to get an LL(k) grammar for a language that is not LL(k-1)
for any k...


Chris Dodd
cdodd@acm.org



Post a followup to this message

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