 
 
 
 
 
   
THREE-ADDRESS CODES are a form of IR similar to assembler for an imaginary machine. Each three address code instruction has the form
x := y op z
t1 := y + z t2 := x + t1
THREE-ADDRESS STATEMENTS are similar to assembly code. We will consider the following statements.
goto Lwhere L is a symbolic label of a statement.
if x relop y goto Lwhere statement L is executed if x and y are in relation relop.
param x1 param x2 param xn call p, ncorresponding to the procdure call p(x1, x2, ..., xn)
SYNTAX-DIRECTED TRANSLATION INTO 3-ADDRESS CODE. We give below a S-definition generating 3-address code from assignments. We use the following attributes
 .place is the name that holds the value of
.place is the name that holds the value of  which may be found
      by consulting the symbol table at
 which may be found
      by consulting the symbol table at 
 .entry.
.entry.
| Production | Semantic Rule | 
| S    : = E | S.code := 
E.code | | generate(  .place, ':=', E.place) | 
| E  E1 + E2 | E.place := newtemp | 
| code := generate(E.place, ':=', E1.place, '+', E2.place) | |
| E.code := E1.code | | E2.code | | code | |
| E  E1*E2 | E.place := newtemp | 
| code := generate(E.place, ':=', E1.place, '*', E2.place) | |
| E.code := E1.code | | E2.code | | code | |
| E  - E1 | E.place := newtemp | 
| code := generate(E.place, ':=', '  ', E1.place) | |
| E.code := E1.code | | code | |
| E  (E1) | E.place := E1.place | 
| E.code := E1.code | |
| E    | E.place :=  .place | 
| E.code := '' | 
 
  means that in this case 
       we do not generate a new temporary for E, 
       instead use the name of the identifier.
 means that in this case 
       we do not generate a new temporary for E, 
       instead use the name of the identifier.
 .place 
      are symbol table pointers.
.place 
      are symbol table pointers.
 
 
 
 
