Three Address Code-1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

THREE ADDRESS CoDE

Theee Addres Code seguence ot


statenent 4he genenal forrm
ohere n armes,
Constants Cornpilert qentnated temporanies
Op stands fort any opeatort such as fixed
fleating potn arithmetie operatot
logical openatort Boolean valued
data

Thus, a s0utie language


ty*.r might . be expreston
ans lated into aukecequen e
and t a+ tu ohe t& t2
compiler genarated
Jenporany nane

Thcee address staternent are akin to


assernbl code Statenents (an have
symbolie labels
abols and thereate, statement
tor flow otof Control.

In 2 Addres Code, each inseeuchion perforems a

Smple opration
addi tion, subttacton, mul-tipicaton, dineien.
The tesutt of thevariaopetaion
ble. hch
s
fs
he stored
used
Jempotany
ojporand in he net nstrucion

Three Address Code (X-Y op z)


X = (a*b)t (e*d)
Vartious statements in 3. Ad dress Code!

OAssigpment

Jmp Condi tionalit telop y goo L


Untondiiomal goto L

) PointeH, addres Asigm’=By

Jnplementatn ot 3 Aldres 8tatenen

Thcee Address Ctatemnt

Guadupls Tripes
Inditect
Tripls
shu ctue with Adota shuctwe
four fields a
cingle +hat nepre
ins trichon an indinect
operalign aferene to
variabe
mmory loeation
Guadruple:
Let (onider an erpresion
a- b k t b

t4
42. = b t1

{5 t2+ 4
at5

Arg 1 Res
Ag2
(o) uminus
2
(1)
(2) Uninus +3
*
(3)| + 43
42 5
i4)
(5) t5.

Truples :
Let tonsi de theame npresien

(The ttúple rep resentaton for the


fequ'ned npessi cn
Ay 2
uninus

2 umi nu

4 + 1

To avod enterig temporar"g narnes


into Hhe tynbol table rmigt
tefen to iNalue
pesition tinporany
the stalern ent
by the
that compdes

Indireet Truple :
Anoth e, implementatton of 33 Addre ode
that hasben conti dered that of
lising pointer
to tiples , ather
than ising 4he triples themielves
This implemen tation caled Indirect
Triple
Let consjdere
a
b*tb
The cwbsequent indine t triple
toprtesentation
Arg Arcg 2
(4) minw

(16) (4)
(r6) mjnus

(1) (6)
(13) + (45) ()
a (1e)

of ponters to +able

Statern ent

(0)
G) (15)
() (16)
(3) ()
(4) (8)

(5)

You might also like