GATE CS 2022 | Question 29

Compiler Design › Parser · NAT · 1 mark · Answer: 5

  1. Question 29Compiler Designnat1 mark
    Consider the augmented grammar with as terminals: ; ; ; . If , then contains exactly __________ items.

    Answer: 5

    Solution

    Answer: 5 . Taking on "+" moves the dot past "+" in the second item: . Its closure adds the -productions and then the -productions:
    [S -> S + . R]
    [R -> . R*P]   [R -> . P]
    [P -> . (S)]   [P -> . id]
    That is 5 items.

More GATE PYQ on Parser

All GATE CS Compiler Design PYQ →

Attempt GATE CS 2022 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →