1 Answers
L-attributed grammars are a special type of attribute grammars. They allow the attributes to be evaluated in one depth-first left-to-right traversal of the abstract syntax tree. As a result, attribute evaluation in L-attributed grammars can be incorporated conveniently in top-down parsing.
A syntax-directed definition is L-attributed if each inherited attribute of X j {\displaystyle X_{j}} on the right side of A → X 1 , X 2 , … , X n {\displaystyle A\rightarrow X_{1},X_{2},\dots ,X_{n}} depends only on
Every S-attributed syntax-directed definition is also L-attributed.
Implementing L-attributed definitions in Bottom-Up parsers requires rewriting L-attributed definitions into translation schemes.