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

6.3.1 Polish Postfix

Polish postfix is a linear line of code which is more useful for code generation that for the optimization phases since it is difficult to do the sorts of ransformations on it which are performed during the optimization phase.

Anyone who has ever used a Hewlett Packard calculator is familiar with Polish postfix (for expressions). Essentially, Polish postfix puts the operands first followed by their operator.

Thus,

    A + B

becomes

    A B +

and

    A + B * C

becomes

    A B C * +

while

    A * B + C

becomes

    A B * C +

The assignment statement:

    S := A + B * C

is denoted

    S A B C * + :=

It is more difficult to devise a reasonable postfix notation for other programming language constructs such as IF statements.

Send questions and comments to: Karen Lemone