Skip to content
GATEiit

GATE CSE 2019 Q53: Number of items in GOTO(I0, '(') for an LR(0) list grammar

Syllabus topic: Lexical analysis, parsing and syntax-directed translation

Question

Consider the augmented grammar given below:

S′→S

S→⟨L⟩∣id

L→L,S∣S

Let I0=CLOSURE({[S′→∙S]}). The number of items in the set GOTO(I0,⟨ ) is: ________.

Try it: numerical answer: type the value

Numerical answer. No negative marking.
Show answer and explanation

Answer: 5 (official GATE 2019 final answer key)

Concept used: GOTO(I, X) moves the dot past X in every item of I that has X right after the dot, and then takes the closure, adding items for every non-terminal that now follows a dot.

Concept notes

Loading notes…

First step: Take the item S→∙⟨L⟩ from I0, move the dot past the bracket to get S→⟨∙L⟩, then add closure items for L and then for S, and count them.

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Lexical analysis, parsing and syntax-directed translation

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2019 CS question paper and final answer key, organised by IIT Madras. Question paper · Answer key