0
$\begingroup$

http://dickgrune.com/Books/PTAPG_1st_Edition/BookBody.pdf

The book by Grune and Jacobs presents an example of a grammar that is $LL(K + 1)$ but not $LL(K)$

The example is $S -> a^kb/a^ka$

The grammar of this type is $LL(K + 1)$ but not $LL(K)$.


I have an example based on the grammar shown. Is this also $LL(2)$ ?

$S-> cca/ccb$

Based on the information above, I just want to confirm that is this grammar also $LL(2)$ but not $LL(1)$ ?

$\endgroup$
1
$\begingroup$

It is neither LL(2) nor LL(1). Read the Grune and Jacobs argument carefully. What is the k in this example?

If the first two characters of the input are "cc", would you know which production to apply? So how can it be LL(2)?

$\endgroup$
  • $\begingroup$ OkK !! My bad . I don't know how I made that mistake. If $S -> ca/cb$, it is actually $LL(2)$ but not $LL(1)$. By similar argument, $S -> cca/ccb$ is neither $LL(2)$ and $LL(1)$, but actually $LL(3)$. Thanks !! $\endgroup$ – Garrick Dec 18 '16 at 15:21
1
$\begingroup$

It is actually $LL(3)$. Try to prove it yourself.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.