Through the quarter, each project group is designing a language and implementing a compiler or interpreter for the language using the Generic Interpreter. In phase 3 we will implement a semantic analyzer for the language. 1 Design a translation scheme for the language you are implementing. The language syntax should be defined by the grammar in your Project Phase 2. 2 Use the Generic Interpreter to construct a semantic analyzer for the language defined by your context-free grammar.
Semantic rules are instances of the class Grammar.
They can be embedded in the right-hand side of productions, and the semantic function named evaluate is invoked when the production is applied to the annotated parse tree. Each grammar symbol in the annotated parse tree has an associated attribute that is an instance of the class Object . The grammar symbols and associated attributes are passed as parameters to the semantic function when it is invoked. Evaluation should not depend on attributes produced by semantic rules below or to the right of this semantic rule. Embedded semantic rules are evaluated after all subtrees rooted in the phrase to be reduced have been visited.