Computer Sciences > GATE 2026 SET-1 > Syntax Directed Definitions
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?
A
SDD2 is an S-attributed SDD and contains only synthesized attributes.
B
The languages P and Q are the same
C
SDD1 is an L-attributed SDD and contains only inherited attributes.
D
The specification of SDD1 and SDD2 are such that the same entries get added to the symbol table.

Correct : a,b

Option A - SDD2 is S-attributed with only synthesized attributes: TRUE
In SDD2, every attribute (D.type, T.type) is computed from the children and flows upward. There are no inherited attributes. This makes SDD2 a classic S-attributed SDD.
Option B - The languages P and Q are the same: TRUE
SDD1 uses a right-recursive grammar (D β†’ TV, V β†’ V1 id | id) and SDD2 uses a left-recursive grammar (D β†’ D1 id | T id). Both describe declarations of the form "type id1, id2, ..." - the same language, just with different parse tree structures.
Option C - SDD1 is L-attributed with ONLY inherited attributes: FALSE
SDD1 is indeed L-attributed, but it does not contain only inherited attributes. T.type and D.type are synthesized attributes. Only V.type is inherited (it receives T.type from the parent). So the claim of "only inherited" is incorrect.
Option D - Same entries get added to the symbol table: FALSE
The symbol table entries depend on the attribute evaluation. Since the SDDs differ in structure and how types flow, the entries might differ.

Similar Questions

A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From...
#1 MCQ
Which number does not belong in the series below? 2, 5, 10, 17, 26, 37, 50, 64
#4 MCQ
Choose the word that is opposite in meaning to the word β€œcoherent”.
#5 MCQ

Related Topics

GATE CS 2026 GATE CS 2026 Set-1 Q22 S-Attributed SDD L-Attributed SDD Synthesized Attributes Inherited Attributes Syntax Directed Definitions Compiler Design GATE SDD1 SDD2 Comparison Symbol Table GATE GATE CS 2026 Solved Parser Attribute Grammar

Unique Visitor Count

Total Unique Visitors

Loading......