L-Attributed Definitions

The idea behind this class is that, between the attributes associated with a production body, dependency-graph edges can go from left to right, but not from right to left(hence "L-attributed"). Each attribute must be either

1. Synthesized, or
2. Inherited, but with the rules limited as follows. Suppose that there is a production A->X1 X2 • • • Xn, and that there is an inherited attribute Xi.a computed by a rule associated with this production. Then the rule may use only:

(a) Inherited attributes associated with the head A.
(b) Either inherited or synthesized attributes associated with the occurrences of symbols X1 X2 • • • Xi-1 located to the left of Xi
(c) Inherited or synthesized attributes associated with this occurrence of Xi
itself, but only in such a way that there are no cycles in a dependency graph formed by the attributes of this Xi.


Example 1: The following definition is L-attributed. Here the inherited attribute of T_ gets its values from its left sibling F. Similarly, T1_ gets its value from its parent T_ and left sibling F.
 Example 2: the definitions below are not L-attributed as B.i depends on its right sibling C’s attribute.

0 comments