From: | Kaz Kylheku <kkylheku@gmail.com> |
Newsgroups: | comp.compilers |
Date: | Wed, 3 Feb 2010 18:18:56 +0000 (UTC) |
Organization: | A noiseless patient Spider |
References: | 10-02-009 10-02-015 |
Keywords: | LL(1) |
Posted-Date: | 05 Feb 2010 17:32:14 EST |
On 2010-02-02, klyjikoo <klyjikoo@gmail.com> wrote:
>
>> I don't think your assumption that any LL(k) can be transformed into
>> an LL(k-1) is correct. The 'k' in LL(k) is assumed to be the supremum
>> of lookahead symbols that you need in order to parse your input. So,
>> suppose you have an LL(2) grammar, then you cannot convert it to an
>> LL(1) since the LL(1) equivalent won't have disjoint FIRST/FOLLOW sets!
>
>> I am not yet very experienced when it comes to compilers, so, if my
>> answer is wrong correct me please! :-)n
>
> Thanks to Hans, Consider this example :
>
> 1) Z := X
> 2) X := Y
> 3) X := bYa
> 4) Y := c
> 5) Y := ca
This grammar generates only a finite set of strings. So it gives a
regular language, which can be described by the regular expression
(cca|bca|bcaa).
It would be astonishing if a regular language could not be described by
a LL(1) grammar.
:)
Return to the
comp.compilers page.
Search the
comp.compilers archives again.