Question 1

Consider the following grammar and the semantic actions to support the inheritance type declaration attributes. Let X1, X2, X3, X4, X5 and X6 be the placeholders for the non-terminals D, T, L or L1 in the following table:

Which one of the following are the appropriate choices for X1, X2, X3 and X4?

X1 = L, X2 = L, X3 = L1, X4 = T
X1 = L, X2 = T, X3 = L1, X4 = L
X1 = T, X2 = L, X3 = L1, X4 = T
X1 = T, X2 = L, X3 = T, X4 = L1
       Compiler-Design       Synthesized-and-L-Attribute       GATE 2019       Video-Explanation
Question 1 Explanation: 
Since the production,
L → L1, id {X3.type = X4.type } , this production has L and L1, hence X3 and X4 cannot be T.
So option 1, 3 and 4 cannot be correct.
Hence, 2 is correct answer.
There is 1 question to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact to get access