List of top Computer Science and IT Engineering Questions on Compiler Design asked in GATE CS

Consider the following two syntax-directed definitions SDD1 and SDD2 for type
declarations.
𝐷 is the start symbol, and 𝑖𝑛𝑑, π‘“π‘™π‘œπ‘Žπ‘‘ and 𝑖𝑑 are the three terminals. The non-terminal
𝑉1 is the same as 𝑉 and the non-terminal 𝐷1 is the same as 𝐷. Here, the subscript is
used to differentiate the grammar symbols on the two sides of a production. The
function 𝑝𝑒𝑑 updates the symbol table with the type information for an identifier.
Let P and Q be the languages specified by grammars G1 and G2, respectively.
Which of the following statements is/are true?
SDD1
Grammar
(G1)
Semantic Rules
𝐷 →𝑇 𝑉
𝐷. 𝑑𝑦𝑝𝑒 = 𝑇. 𝑑𝑦𝑝𝑒
𝑉. 𝑑𝑦𝑝𝑒 = 𝑇. 𝑑𝑦𝑝𝑒
𝑇 β†’ 𝑖𝑛𝑑
𝑇. 𝑑𝑦𝑝𝑒 = 𝑖𝑛𝑑
𝑇 β†’ π‘“π‘™π‘œπ‘Žπ‘‘
𝑇. 𝑑𝑦𝑝𝑒 = π‘“π‘™π‘œπ‘Žπ‘‘
𝑉→𝑉1 𝑖𝑑
𝑉1. 𝑑𝑦𝑝𝑒= 𝑉. 𝑑𝑦𝑝𝑒
𝑝𝑒𝑑(𝑖𝑑. π‘’π‘›π‘‘π‘Ÿπ‘¦, 𝑉. 𝑑𝑦𝑝𝑒)
𝑉 β†’ 𝑖𝑑
𝑝𝑒𝑑(𝑖𝑑. π‘’π‘›π‘‘π‘Ÿπ‘¦, 𝑉. 𝑑𝑦𝑝𝑒)
SDD2
Grammar
(G2)
Semantic Rules
𝐷→𝐷1 𝑖𝑑
𝐷. 𝑑𝑦𝑝𝑒= 𝐷1. 𝑑𝑦𝑝𝑒
𝑝𝑒𝑑(𝑖𝑑. π‘’π‘›π‘‘π‘Ÿπ‘¦, 𝐷1. 𝑑𝑦𝑝𝑒)
𝐷 β†’ 𝑇 𝑖𝑑
𝐷. 𝑑𝑦𝑝𝑒 = 𝑇. 𝑑𝑦𝑝𝑒
𝑝𝑒𝑑(𝑖𝑑. π‘’π‘›π‘‘π‘Ÿπ‘¦, 𝑇. 𝑑𝑦𝑝𝑒)
𝑇 →𝑖𝑛𝑑
𝑇. 𝑑𝑦𝑝𝑒 = 𝑖𝑛𝑑
𝑇 β†’ π‘“π‘™π‘œπ‘Žπ‘‘
𝑇. 𝑑𝑦𝑝𝑒 = π‘“π‘™π‘œπ‘Žπ‘‘