Open In App

GATE | GATE MOCK 2017 | Question 26

Like Article
Like
Save
Share
Report

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


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads