retagged by
661 views
0 votes
0 votes

The grammar $E \to T + E \mid T$ is?

  1. $\text{LR}(0)$ and $\text{LL}(1)$
  2. Not an operator grammar
  3. Ambiguous
  4. $\text{SLR}(1)$ but not $\text{LL}(1)$

As the question did not seem to be complete , I am trying to guess the question from the answer ( shame on these test series guys , can't even proof-read question ).

retagged by

4 Answers

2 votes
2 votes
This Grammar is not LL(1) because we have to put both Production  in first of RHS which is first of  T ,  in this way 2 production are going in to same cell so there is a conflict.

If we find out canonical collection of Lr(0) items then we are going to get 1 SR conflict so it is not LR(0) .But that conflict can be easily resolved by SLR(1).

ANS : option D is correct Grammar is SLR(1) but not LL(1).
0 votes
0 votes
It is useless grammar. It doesnot generate any terminals. May be ambiguois might be the answer. I dont know what they meant
0 votes
0 votes

Grammar is not complete..You can't say about ambiguity.(option c is eliminated)

Still if we explore..

It is satisfying the conditions of operator grammar. (option b is eliminated)

However we are not able to find FIRST but we can think that it is not LL(1) because from both of the productions we are getting FIRST(T) hence we will not get disjoint set so it is not LL(1) 

Now if you try to make cannonical collection of LR(0) item. You will find a SR conflict which will be solved by SLR(1).

I think Option (d) is correct 

Related questions

0 votes
0 votes
1 answer
1
worst_engineer asked Jan 9, 2016
1,399 views
Will not there be 3 SR conflicts in CLR(1) reduction ?In fact their ans also says this :In the state I1 , will it not be SR conflict ?
0 votes
0 votes
3 answers
2
8 votes
8 votes
3 answers
3
Parshu gate asked Nov 13, 2017
15,520 views
Suppose we are given a grammar and asked to find the type of that grammar , what is the algorithm which needs to be followed for each of them? LL(1), OR LR(0) , OR CLR(1...
0 votes
0 votes
2 answers
4