Attribute Grammars: Difference between revisions

From Wiki**3

No edit summary
No edit summary
Line 8: Line 8:


L-attributed grammars: inherited attributes are only dependent on the parents' attributes or on the older brothers' (i.e., when evaluating left-to-right, only previously seen attributes are needed).
L-attributed grammars: inherited attributes are only dependent on the parents' attributes or on the older brothers' (i.e., when evaluating left-to-right, only previously seen attributes are needed).
== Exercises ==
* [[Attribute Grammars/Exercise 1: Semaphore|Exercise 1: Semaphore]]
* [[Attribute Grammars/Exercise 2: Numbers|Exercise 2: Numbers]]
* [[Attribute Grammars/Exercise 3: Expressions|Exercise 3: Expressions]]


[[category:Compilers]]
[[category:Compilers]]
[[category:Teaching]]
[[category:Teaching]]

Revision as of 15:12, 18 April 2009

Topics: attributes in grammar symbols; syntax-directed evaluation.

Synthesized attributes: passed from child nodes to parent nodes.

Inherited attributes: may be passed from parent- to child nodes or between siblings.

S-attributed grammars: only synthesized attributes.

L-attributed grammars: inherited attributes are only dependent on the parents' attributes or on the older brothers' (i.e., when evaluating left-to-right, only previously seen attributes are needed).

Exercises