Attribute Grammars Flashcards
consists of semantic rules that can be checked during program compilation
Static semantics
a descriptive formalism that can describe both the syntax and static semantics of a language; extension to context-free grammars; consists of a grammar, a set of attribute, a set of attribute computation functions, and a set of predicates, which together describe semantic rules
Attribute grammar
specify how attribute values are computed
Attribute computation functions
state the semantic rules of the language
Predicate functions
What are the two (2) classes of attributes?
- Synthesized attributes
- Inherited attributes
pass semantic information up a parse tree, meaning from the attributes attached to the children of its nonterminal
Synthesized attributes
pass semantic information down and across a tree, meaning from the attributes attached to the parent (or siblings) of its nonterminal
Inherited attributes