GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2026 set1

GATE 2026 set1 · CS · MSQ · 2 marks · Compiler Design › Semantic Analysis

GATE 2026 set1 Computer Science and Information Technology question: Consider the following two syntax-directed definitions SDD1 and SDD2 for type…

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 is the same as and the non-terminal 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.

SDD1, Grammar (G1):

Production Semantic Rules
;
;

SDD2, Grammar (G2):

Production Semantic Rules
;
;

Which of the following statements is/are true?

  1. (A)

    The languages P and Q are the same

  2. (B)

    SDD2 is S-attributed and contains only synthesized attributes

  3. (C)

    SDD1 is L-attributed and contains only inherited attributes

  4. (D)

    The specifications of SDD1 and SDD2 are such that the same entries get added to the symbol table

Show answer

Official answer: A,B,D

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion