A syntax-directed definition is L -attributed if each inherited attribute of X j for i between 1 and n , and on the right side of production A ’ X 1 X 2 , X n , depends only on:
The attributes (both inherited as well as synthesized ) of the symbols X 1 , X 2 , , X j ˆ’ 1 (i.e., the symbols to the left of X j in the production, and
The inherited attributes of A .
The syntax-directed definition above is an example of the L -attributed definition, because the inherited attribute L .type depends on T .type, and T is to the left of L in the production D ’ TL . Similarly, the inherited attribute L 1 .type depends on the inherited attribute L .type, and L is parent of L 1 in the production L ’ L 1 ,id.
When translations carried out during parsing, the order in which the semantic rules are evaluated by the parser must be explicitly specified. Hence, instead of using the syntax-directed definitions, we use syntax-directed translation schemes to specify the translations. Syntax-directed definitions are more abstract specifications for translations; therefore, they hide many implementation details, freeing the user from having to explicitly specify the order in which translation takes place. Whereas the syntax-directed translation schemes indicate the order in which semantic rules are evaluated, allowing some implementation details to be specified.