1.

Consider the following grammar and the semantic actions to support the inherited 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:Production ruleSemantic actionD → T LX1.type = X2.typeT → intT.type = intT → floatT.type = floatL → L1, idX3.type = X4.typeaddType(id.entry, X5.type)L → idaddType(id.entry, X6.type) Which one of the following are the appropriate choices for X1, X2, X3 and X4?

A. X1 = L, X2 = T, X3 = L1, X4 = L
B. X1 = T, X2 = L, X3 = L1, X4 = T
C. X1 = L, X2 = L, X3 = L1, X4 = T
D. X1 = T, X2 = L, X3 = T, X4 = L1
Answer» B. X1 = T, X2 = L, X3 = L1, X4 = T


Discussion

No Comment Found