GATEverse
← GATE CSE 2019

Q36

MCQ2 marks, −0.67

Consider the following grammar and the semantic actions to support the inherited type declaration attributes. Let X1,X2,X3,X4,X5X_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 actionD→TLX1.type=X2.typeT→intT.type=intT→floatT.type=floatL→L1,idX3.type=X4.typeaddType(id.entry,X5.type)L→idaddType(id.entry,X6.type)\begin{array}{|l|l|} \hline \text{Production rule} & \text{Semantic action} \\ \hline D \rightarrow T L & X_1.\text{type} = X_2.\text{type} \\ \hline T \rightarrow \text{int} & T.\text{type} = \text{int} \\ \hline T \rightarrow \text{float} & T.\text{type} = \text{float} \\ \hline L \rightarrow L_1, id & X_3.\text{type}= X_4.\text{type} \\ &\text{addType}(id. \text{entry}, X_5.\text{type})\\ \hline L \rightarrow id & \text{addType}(id. \text{entry}, X_6.\text{type}) \\ \hline \end{array}

Which one of the following are appropriate choices for X1,X2,X3X_1, X_2, X_3 and X4X_4?

Sign in to save attempts.

Loading…