Example 5

This example shows the input of an attribute grammar to the semantic analyzer generator. The two attributes Use and Def, are associated with various nonterminals in the grammar.

At parse time, the nodes will be lableled with these (unevaluated) attributes, and at semantic analysis time, the values of these attributes will be computed by propagating information up the parse tree. Example 6 shows the results produced by the generated semantic analyzer.

Send questions and comment to: Karen Lemone