Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE MOCK 2017 | Question 26

  • Last Updated : 28 Jun, 2021

Which of the following intuitive definition is true about LR(1) Grammar.
(A) For a grammar to be LR(1) it is sufficient that a left-to-right shift reduce parser be able to recognize handles of right-sentential form when they appear on the stack.

(B) For a grammar to be LR(1) it is sufficient that a left-to-right shift reduce parser be able to recognize handles of left-sentential form when they appear on the stack.
(C) For a grammar to be LR(1) it is sufficient that a left-to-right shift reduce parser be able to recognize handles of left-sentential form or right-sentential form when they appear on the stack.
(D) All of the above


Answer: (A)

Explanation: LR(1) – Reading the input string from left to right.
LR(1) – Deriving a right-most derivation for the string.

LR(1) – one token look-ahead

In the first choice we read from Left to right deriving the right-most sentential form and looking one symbol ahead which is stack top. So option (a) is correct.



Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :