0% found this document useful (0 votes)
4 views5 pages

Unit-8 Intermediate Code Generation

The document discusses intermediate code generation, which is a crucial step in compiling source code into machine language. It explains various representations of intermediate code, including three-address code, syntax trees, and postfix notation. Additionally, it outlines the structure and examples of different types of intermediate code representations, emphasizing their role in simplifying the compilation process.

Uploaded by

udaybagada36
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Unit-8 Intermediate Code Generation

The document discusses intermediate code generation, which is a crucial step in compiling source code into machine language. It explains various representations of intermediate code, including three-address code, syntax trees, and postfix notation. Additionally, it outlines the structure and examples of different types of intermediate code representations, emphasizing their role in simplifying the compilation process.

Uploaded by

udaybagada36
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

8CenerotionTntermediate Code

IntesmediateCode:
ComPiles ConvestS ehe SoUdce P a m
mto ecsy to
dePresemt cmuage
lamguoge Called
eTmediate
+ho lungucge
CeCC
befose translatin2
directY befote lcatI
in+o
macwne
mucne uvuage
The dePre
entction of Hhe
S
avauce Prorm.
rjam,
ngucge Caum be
Classilies jntesmedi
ate
(1) Hiah level as:
KePresentadtion:
T + is closesto h e Souce Progam
T etang
T + is hePaogaUm9¥TuCture
easy to
genesaterom Hhe
u t in
He, Code P he1]pilp Paq1a
Paejra
zatiom is n
S+Saight toTOaTd. ot
Ex Syn+ax tree
Pos+fix ExPTessioM,
DA
Lo vel ePresentatoL
3T4 is C os es fo h e
T+ 7s ecsy to taxaeA mactinee
3enerotetara
tasaet Code
fvom f i s , et Code
I+ Tequres mo
1ow ew el effor+S o
e

En
t e rmediate Code enerete
Cede aom
>om
Three - addreSs Source Code.
Code.
Code.
Sumtax Iec :
T+ S S C ComPact oTm of PaTse
tee +het
ePesenE
he ieracica
S+TUCAUTe o h e PoUA
I n SvmtcAx m.
tre e
Imterio odebaamch
+he OPeCHOD S, nodeg TePTesents
LeLeef nodel Tevmimcd node
+he OPedAndS. de Presents

DA COire cted Acc1ic CraPh):


T+ s
but in moz SimilA o
Sy Cx t e e
CemPeAct foTm. Thot is
DA Common in
SubexPTessionS C e dePresen}td
bysnale mode.
Example a= b*-c+b-c

CL

Umimuß b Uminus
Umins
C

Svntax Tree oAK


*Postfix Notusions /ExPressitns:
T+ s aineaization of c Svn tax tsee.
Tn Pos4ix motation, the opeTcmdS occurs
first Cmd hen OPeTatoss are arremgd,
T 4 is m e ComfACA oTm ofSynie
tree

Example (A + B) *CC+D)
Pos+tix motC+ion : AB CDt*
hsee Address Code
The 4esm }hree Odddess Code" Conains
+hree
And
addesses,fwo toa +Hhe oPerandS
Ome o r h e desult.

Thre e
addre ss Code is a Sequemce ot
Statememt of +he. o t r :
a : b OP C
here, CL,b and C the ae
het Com be names OPeTand s
o r Consaunt=
OP StamdS t o r amy
SPeTtoT.
Ex a =b+ C+d X X *Y +
z-X
Thsee address Code 1s:
ti X*Y
t i = b +c
t2 t1+ Z
ta t1+d t3 t2 -X
a t2 X t3B

tz d 3 CTe h e tem PoTuy


Hee, ti ,
he ComfSler
enerated by
mames
Oifferent Ke PTe senta+ion of hree
Address Code
( Quad uple
Tri Ples
( Tndirect iPle

xamPle 3 X = -

CL* b t - al*b
t CL
t2 t1 *b Three Address Code
t3-CL
t4 t3 * b
ts t z t t y
X
t5

Qucdurle
T+ is
Repesentathom 2
Such as
aSHucAUre c h
cUim ct most
OP, CAsg1 , mos t
ars2 and [Link]
tour tieds
tieds
OPerator Asgi Ay2 Result
(oUminus a t1
C * ti b t2
(Uminus aL t
(3 Lab
C + t ty ts
G5)= ts
Tirle RePresentation
not used
Im riple, temPoraries are
SYmo)
nsed of h c t Pointers i n he

able ade used direc+|Y.


T7iples OC Poesentatio is the 6TuCAuTE

COith at moSt three ields CA1,aa32


CAmd OPesCHOr CoP)

OP A Ars2
(o Umimus a

C1 (0)
Cz mimus a

(3 (2
C4 C1 C3)
CS (4)

Indtrec+ iPle RePresentaution


mHis,
+His, h e listin o¥ toiples has been dome
Omd US+ing Pointexs a r e used imSteà oP
usins Statement.

SHatemet OP A1 Aaj2
Co14) Co minus CL
CIS Ct C14D b
C1
C2 mimus C
(2 (16
C3C17D C3 C16) b
(4 + C15) C14
(4 C18)
CsC11
C C18)

You might also like