ii and iv are true

i is false as a regular grammar can also be ambiguous

for clarification on iv, go through the explanations here https://gateoverflow.in/906/gate2003-16

The Gateway to Computer Science Excellence

0 votes

Consider the statements: (i) Every regular grammar is LL(1) (ii) Every LL(1) grammar is LALR(1) (iii) All LR(0) grammars are LL(k) (iv) A context-free grammar without left factoring and left recursion can be ambiguous Which of the above statement/s is/are TRUE?

(i) only

(i) and (iii) only

(ii) and (iv) only

(iv) only

(i) only

(i) and (iii) only

(ii) and (iv) only

(iv) only

+2

ii and iv are true

i is false as a regular grammar can also be ambiguous

for clarification on iv, go through the explanations here https://gateoverflow.in/906/gate2003-16

0

yes aambazinga your ans. is correct. but statement 3. All LR(0) grammars are LL(k) why this statement is false

and can you explain why statement 4 is correct.

0 votes

(i) Every regular grammar is LL(1)

- No, because regular grammar can be ambiguous/ left recursive/left factored.

(ii) Every LL(1) grammar is LALR(1)

- No, It's opposite.

(iii) All LR(0) grammars are LL(k)

- No, both are different types of parser. LR(0) just need to be unambiguous but LL(1) needs to be unambiguous + Not left recursive + not left factored.

(iv) A context-free grammar without left factoring and left recursion can be ambiguous

- True.

- No, because regular grammar can be ambiguous/ left recursive/left factored.

(ii) Every LL(1) grammar is LALR(1)

- No, It's opposite.

(iii) All LR(0) grammars are LL(k)

- No, both are different types of parser. LR(0) just need to be unambiguous but LL(1) needs to be unambiguous + Not left recursive + not left factored.

(iv) A context-free grammar without left factoring and left recursion can be ambiguous

- True.

52,375 questions

60,586 answers

202,005 comments

95,409 users