in Compiler Design
6,833 views
4 votes
4 votes
Consider the grammar with the following productions.
S→aaB/aaC
B→b
C→c
Which of the following option is true ?

(A) The grammar is LL(3)

(B) The grammar is LL(1)

(C) The grammar is LL(2)

(D) It can’t be LL(k) grammar for any k, as it contains left factoring.
in Compiler Design
6.8k views

4 Comments

A grammar to be LL(k) grammar, its first k symbols of any two productions should not be same.

If you take LL(1) then in its S production it is similar.

If you take LL(2) then in S production aa is same as aa. 

If you take LL(3) then in S production it is aab and aac which is not same.

Hence this grammar is not LL(1) and LL(2) but is LL(3).

12
12
Got it... Thank you.. :)
0
0
Thanks @subhanshu

If G is LL(K)

means kth term in length of two production should be unique.
0
0

1 Answer

0 votes
0 votes
The grammar is LL(3) option A is right

Related questions