|
6.5.3 S-Attributed Attribute GrammarsAttribute in an S-attributed grammar can be evaluated at parse time by a bottom-up parser. Interestingly, these grammars form a subset of the L-attributed grammars. An attribute grammar is S-attributed if and only if:
This allows attributes to be evaluated during LR-parsing. L-attributed and S-attributed grammars allow efficient evaluation---either during parsing or as a single pass after parsing. In Section 6.6, we see another method and a different attribute restriction that allows attribute evaluation during top-down parsing. For the next few sections, we focus on restrictions to attributes that allow for efficient attribute evaluation. Send questions and comments to: Karen Lemone |