6.0 Introduction

6.1 Static Checking

6.2 Attribute Grammars

6.3 Translation to an IR

6.4 Semantic Analyzer Generators

6.5 More on Attribute Grammars

6.6 Attribute Evaluation

6.7 Summary

Web References

Exercises

mod1fig5.gif (9955 bytes)

6.0 Introduction

Computer programs, like English sentences, have both a syntactic structure, illustrated by a parse tree, and a semantic structure which describes the meaning. Although there are many formal definitions of program semantics, we will take the operational semantics point of view. This approach defines the meaning of a program to be the executable code it generates. For us, this is the assembly language code. Thus, the actions performed by the semantic analysis phase are a begining of the process which will generate code.

Specifically, semantic analysis performs two major actions: (1) it finishes the syntax analysis and also performs actions such as symbol table creation and (2) it translates the parse tree to an intermediate representation more appropriate for the later phases of optimization and code generation.

Send questions and comments to: Karen Lemone