MCQ · 2 marks · Syntax Directed Translation

GATE CS 2019 CS — Q36

Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let X1,X2,X3,X4,X5,X_1, X_2, X_3, X_4, X_5, and X6X_6 be the placeholders for the non-terminals D,T,LD, T, L or L1L_1 in the following table:
Production ruleSemantic action
D→T  LD \to T \; LX1.type=X2.typeX_1.\text{type} = X_2.\text{type}
T→intT \to \text{int}T.type=intT.\text{type} = \text{int}
T→floatT \to \text{float}T.type=floatT.\text{type} = \text{float}
L→L1,idL \to L_1, \text{id}X3.type=X4.typeX_3.\text{type} = X_4.\text{type}; addType(id.entry,X5.type)\text{addType}(\text{id.entry}, X_5.\text{type})
L→idL \to \text{id}addType(id.entry,X6.type)\text{addType}(\text{id.entry}, X_6.\text{type})
Which one of the following are the appropriate choices for X1,X2,X3X_1, X_2, X_3 and X4X_4?
Select one option