GATEverse Practice, past papers & mock tests
GATE 2026 · CS1 - Forenoon
Compiler DesignParsing TechniqueshardMSQ2 marks
Consider the following two syntax-directed definitions for type declarations.
SDD1: Grammar \(G_1\)Semantic rules
\(D \to TV\)\(D.\mathrm{type}=T.\mathrm{type};\; V.\mathrm{type}=T.\mathrm{type}\)
\(T \to int\)\(T.\mathrm{type}=int\)
\(T \to float\)\(T.\mathrm{type}=float\)
\(V \to V_1\,id\)\(V_1.\mathrm{type}=V.\mathrm{type};\; \operatorname{put}(id.\mathrm{entry},V.\mathrm{type})\)
\(V \to id\)\(\operatorname{put}(id.\mathrm{entry},V.\mathrm{type})\)
SDD2: Grammar \(G_2\)Semantic rules
\(D \to D_1\,id\)\(D.\mathrm{type}=D_1.\mathrm{type};\; \operatorname{put}(id.\mathrm{entry},D_1.\mathrm{type})\)
\(D \to T\,id\)\(D.\mathrm{type}=T.\mathrm{type};\; \operatorname{put}(id.\mathrm{entry},T.\mathrm{type})\)
\(T \to int\)\(T.\mathrm{type}=int\)
\(T \to float\)\(T.\mathrm{type}=float\)
\(D\) is the start symbol; \(int\), \(float\), and \(id\) are terminals. \(V_1\) denotes \(V\), and \(D_1\) denotes \(D\); subscripts distinguish the corresponding grammar symbols on opposite sides of a production. The function \(\operatorname{put}\) records an identifier's type in the symbol table. Let \(P\) and \(Q\) be the languages specified by grammars \(G_1\) and \(G_2\), respectively. Which of the following statements is/are true?

Select every correct option.

Save your progress

Related Compiler Design PYQs