edited by
1,732 views
1 votes
1 votes
Consider the grammar:
S -> (XSS) | (XS) | a
X -> b

Which one of the following is true?
(A) The grammar is in LL(1) but not in SLR(1)
(B) The grammar is in SLR(1) but not in LL(!)
(C) The grammar is in both SLR(1) and LL(!)
(D) The grammar is neither in SLR(1) nor in LL(!)
edited by

4 Answers

2 votes
2 votes
The grammer is not LL(1) since in column { ( }  we will get 2 entries

But I think the grammer is SLR(1)

So Answer should be C)
1 votes
1 votes

Grammer is not LL(1). since First ((XSS))  = ( = First ((XS))   

If grammer is Not LL(1) then Not SLR(1).

D

0 votes
0 votes
Option D is right option for it.

Explanation::

S->XSS will kept under action prt of b.

Similirly S->XS will be kept under action part of b.

So under same enteries we never ever put more than one value so given grammar is not LL(1).

For SLR(1) ,reduces item kept under the the follow of left hand symbol.So if u check above it is not SLR(1)

Related questions

2 votes
2 votes
4 answers
1
Rakesh K asked Oct 12, 2016
2,274 views
Consider the grammar:S - ab | acIs this grammar LL(1)?My try : I tried doing the left-factoring and create the LL(1) table and found that the grammar is LL(1), but the an...
2 votes
2 votes
3 answers
2
1 votes
1 votes
2 answers
3
Nishu asked Mar 3, 2016
9,451 views
Consider the following grammer:S- aAb | ScA- d | Sd | SThe above grammer is:a) SLR(1)b) LL(1)c) LR(0)d) none of the above
2 votes
2 votes
1 answer
4
sripo asked Nov 10, 2018
3,264 views
Can you give an example which is not LL(1) but is CLR(1)