GATE Computer ScienceModerateGATE CS (PYQ pattern)

Consider an SDD where for A → B C the rules are: B.i = A.i + 1, C.i = B.s, A.s = C.s. Which statement is correct?

  1. A. It is not L-attributed, because C.i uses B.s, a synthesised attribute of a sibling symbol
  2. B. It is S-attributed, because the only synthesised attribute of A is computed from C.s
  3. C. It is L-attributed: each inherited attribute uses only the parent's inherited attributes and left siblings
  4. D. It is neither L-attributed nor S-attributed, because B.i uses the inherited value of the parent

Correct answer: C. It is L-attributed: each inherited attribute uses only the parent's inherited attributes and left siblings

S-attributed would forbid the inherited attributes B.i and C.i. L-attributed allows an inherited attribute to use the parent's inherited attributes and the attributes of siblings to its left: B.i uses A.i, and C.i uses B.s (B is to the left of C).

More Compiler Design questions

Exams that ask this topic