edited by
1,157 views
3 votes
3 votes
A non left recursive and left facotred grammar in which all non-empty rules defining the same non terminal have disjoint first sets, such grammar is called _____________

a) LL(1)

b) LR(0)

c) LR(1)

d) None

asnwer given LL(1). but i think bcoz of follow there can be conflict hence none of these should be the answer. Is it right??
edited by

1 Answer

Best answer
3 votes
3 votes

Let us understand this question and try to know why conflict occurs in LL(1) parser despite being non left recursive and non left factored..This happens in 2 scenarios :

A) When we have choice in productions and they are originating from same variables , if first of 2 productions have something in common , then both these productions will have to be placed into same column(terminal which is common in first of 2 productions and same row(variable which is responsible for the productions)..So in that case conflict will occur..

Said in other way , if they are disjoint , then we have only one possibility and that is due to null productions in which case we have to place in follow of lhs of production..In that case there may be collision also.

But in the question it is given : " all non-empty rules " indicating that they will not produce epsilon..

Hence the parser(grammar) is guaranteed to be LL(1)..

Hence A) is the correct answer..

selected by

Related questions

0 votes
0 votes
1 answer
2
Na462 asked Jan 16, 2019
790 views
Which of the Statements are True :S1: LR(1) grammar can be LR(0) but not LL(1).S2 : Every regular language is LL(1)S3 : Three address code is linear representation of Syn...
3 votes
3 votes
1 answer
3
1 votes
1 votes
0 answers
4
rahul sharma 5 asked Oct 29, 2017
578 views
The given answer is 5,i am getting 616 in CLR and 10 in LALR.Please someone confirm?