Attribute grammars

Basic idea

Augment a CFG by attaching attributes to grammar symbols and semantic rules that compute them. A clean way to fold static analysis (type checking, scope resolution) directly into parsing.

Key facts

  1. S-attributed grammars
  2. L-attributed grammars