Consider the following SDD: T → FT₁ {F.val = T₁.val} T₂ → *AT₃ {T₂.val =…
Consider the following SDD:
T → FT₁ {F.val = T₁.val}
T₂ → *AT₃ {T₂.val = T₃.val × A.val}
Which of the following is true?
Answer: D. None of the above — F.val = T1.val assigns an attribute of the left child (F) using the right sibling (T1) — this is an inherited attribute depending on a right sibling.…
- A.
This SDD follows S-attributed definition.
- B.
This SDD follows both S-attributed as well as L-attributed definition.
- C.
This SDD follows L-attributed definition.
- D.
None of the above
Attempted by 50 students.
Show answer & explanation
Correct answer: D
F.val = T1.valassigns an attribute of the left child (F) using the right sibling (T1) — this is an inherited attribute depending on a right sibling.S-attributed SDDs allow only synthesized attributes (no inherited) → violated.
L-attributed SDDs allow inherited attributes to depend only on the parent and left siblings → violated (depends on a right sibling).
Therefore the SDD is neither S-attributed nor L-attributed.