This document provides an overview of syntax-directed translation and attribute grammars. It discusses:
- Syntax-directed definitions associate semantic rules with production rules to evaluate attributes and perform actions like code generation. Attributes can represent various types of information.
- Syntax trees can be annotated with attribute values. The order attributes are computed depends on semantic rule dependencies.
- Translation schemes specify an order for evaluating semantic actions associated with productions. This provides implementation details omitted from syntax-directed definitions.
- S-attributed and L-attributed definitions are subclasses that allow efficient single-pass evaluation during parsing by restricting how attributes can be used.