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. π‘π¦ππ)
π· β π ππ
π·. π‘π¦ππ = π. π‘π¦ππ
ππ’π‘(ππ. πππ‘ππ¦, π. π‘π¦ππ)
π βπππ‘
π. π‘π¦ππ = πππ‘
π β πππππ‘
π. π‘π¦ππ = πππππ‘