## Synthesized-and-L-Attribute

Question 1 |

Consider the following grammar and the semantic actions to support the inheritance type declaration attributes. Let X_{1}, X_{2}, X_{3}, X_{4}, X_{5} and X_{6} be the placeholders for the non-terminals D, T, L or L_{1} in the following table:

Which one of the following are the appropriate choices for X_{1}, X_{2}, X_{3} and X_{4}?

X _{1} = L, X_{2} = L, X_{3} = L_{1}, X_{4} = T | |

X _{1} = L, X_{2} = T, X_{3} = L_{1}, X_{4} = L | |

X _{1} = T, X_{2} = L, X_{3} = L_{1}, X_{4} = T | |

X _{1} = T, X_{2} = L, X_{3} = T, X_{4} = L_{1} |

Question 1 Explanation:

Since the production,

L → L

So option 1, 3 and 4 cannot be correct.

Hence, 2 is correct answer.

L → L

_{1}, id {X_{3}.type = X_{4}.type } , this production has L and L_{1}, hence X_{3}and X_{4}cannot be T.So option 1, 3 and 4 cannot be correct.

Hence, 2 is correct answer.

There is 1 question to complete.