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

Unit 1 CD CD Notes

The document provides notes on Compiler Design for B.Tech CSE students, covering key concepts such as translation, compilation, and the differences between compilers and interpreters. It outlines the phases of a compiler, including lexical analysis, syntax analysis, and semantic analysis, as well as the role of intermediate code generation. Additionally, it discusses the importance of syntax trees and tokenization in the compilation process.

Uploaded by

agjlpqekn
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 views21 pages

Unit 1 CD CD Notes

The document provides notes on Compiler Design for B.Tech CSE students, covering key concepts such as translation, compilation, and the differences between compilers and interpreters. It outlines the phases of a compiler, including lexical analysis, syntax analysis, and semantic analysis, as well as the role of intermediate code generation. Additionally, it discusses the importance of syntax trees and tokenization in the compilation process.

Uploaded by

agjlpqekn
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
You are on page 1/ 21

lOMoARcPSD|49086899

Unit-1 (CD) - cd notes

B.tech cse 6th Compiler Design (I. K. Gujral Punjab Technical University)

Scan to open on Studocu

Studocu is not sponsored or endorsed by any college or university


Downloaded by Harry Jon ([email protected])
lOMoARcPSD|49086899

Paga No.
Date)

* Tnanslaton
ne fohy
A tramy lator is a bogram tat takeA t
A
Tnbut amcl cenuerts iato
Qmote form"

Tne inbt is Galled Snace pfam


Rs callecd tag pragam
Tme SoLne langqage can be arsemhly angage
hi'gaa Pouel PangLe eika Gctt
Tinterpete 3 Asse mlez
Coniler
SPTranslasTp

Compiler
AConbile isa p0gaba tat zoeca a fagIaM
oce angage (ighlael ly) aned
(machine tan
Tae Combiler alyo alps in chekuig the ene2
machine aauay
emtine þrejam ct a hime
Jtcomvert
Snce Tyt
Downloaded by Harry Jon ([email protected])
Cocle Coes
Downloaded by Harry Jon ([email protected])
Nacune Asomely
RI,idy MOV
ol R2,R DO A
RIic3, Mo
Cede machine the
the tes ohh toanylaton mle2 Asse
mble Asse 3
haulel'
tamkte tine
pagam
to obfam e (onent
Tnteboter onby to zue Sk
kangage main Vondl
dine
equivclent by Rin
amel anguage sae am into tainates
it
a hat gam oitden
fn
fn
Intezhrler
la itten is progam
Tntezpuder
Tanget
bz2,(; azl, Lnt
Date
ooloO000loNo. Page ()mun Void
lOMoARcPSD|49086899
lOMoARcPSD|49086899

Page No.
|Date|

*Diferene Setoeen com<ilez Tnieahretes


Combilez Ttepsale
) Scams the emtie pny t cthe
anl 9anslates taud Cme tatement
bsholeino macun cd

atgiee enhia piaopm|eay înstsuchiy inleatekd


is checcec
3) t q2nexates imtezmediste 4t dod not
Coce

) Memony aepuinementis is le

Basis ytn
*Aralyis Saheus malel ay Copilatica

Thene
Aadyu's phani Smthesis phae
pae The man objecive oo the
Pats and then 9ms these pieces
to Stactuu Analys's pt
Downloaded by Harry Jon ([email protected])
lOMoARcPSD|49086899

is ddlecl nto Hee Sub pats


lolal analypsi J inea analyis
Synkn akalus aachial analy'spa,y
bemanti andyai
Lineae
in hic
anahyuis
ne staeam ab charactes makng up
elt to
ayut amel graupecl into tokens that are
Se_ o chenotens aoig a Collechve meanf
Confiler, inoaz amalyais s caloeel
Racical analys Samniy
postion Iniha tle * 60
fotlaing tokani
The ickntife boshn
2
3
Tneaisigmment
The ícenhfie hal
The p\us sip
Tne icdenti he
6 The
Tne

n
Hienanchital analy's
claanaedens o tokens ane
hieanch'aly
lorth abletve
nto neste) ollect ons.

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Page No.
Date

t inolves goauoing the tokens alg te soece

Hhe Canileeto spathesize tst


farse tre fo

Qusifnment
tateme nt

Tdenbfe
iclesife
inal

3Semamte analyss
Certain checks Gra perhmec) to enyre
thst theomhmentsot a pugkam t toyet
meaningully
iegrchilal Stauctu cletehynod
plase ideathy
cperctoRs amd operans
oferaws
Downloaded by Harry Jon ([email protected])
lOMoARcPSD|49086899

Page No.
Date

t TH£PHASES OF A CoMpTcR
Sorce

osubtes lexcica
Anay2e
Shy
Analyza
Semantc

tuble
temectat
Cocle
Hamlle
lyeneale
Ccle
aphimies
Cocde
Gemeator

Bynbal- Table Nanagement


A Smbel telle
brdaninga eoncl fun each fdenthfiey,
otth frelds fon the adtusey o

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Paga No.

Caruig
oEo detechng Rebottiie
Cach phase Cmcounes
atea dedechy am mustom
hodbal tHaat enO
h the
Aouce pag9a o be cletected A Gnpilo tat
Atohs when itfinds the fhiast eue is o7 ay

i) leual analyua
leital tnalyzes aiviclea the gien Sace.
pgam nTo token
ofentt
folal clae
Constanh, keypaarcds et ane ertey

poshen Laitl ate 6a


Sequke

Passton
inihal e2tjd3* 6o
3 Rate

pariy ieromckical fhralyois le'cal


Jt tate~. the teken producel
ais as nbut and
inþut

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Page No.
Date

hae token 0rnegeMenIs


checked against the Soiuce co dle qra
farue Checks the
the bkenss
ptchiaaty
posihne mihalt ate 6o

Sqaday Aaalysls

Demanhe
Aralyssdetesine
Sernanse pnalyze tctt
te meaning ay a sauce Shriy
1t
3

pefomg aitimeh qperaitn


Hhat
ype ompadyle

Downloaded by Harry Jon ([email protected])


abbetod Mol
Downloaded by Harry Jon ([email protected])
is
code
nyMes
tte fave
a necessaay
Coco
optimizeq anatptacduces
iate inpl as
eliale qptinizahn
the gts phse Cole
mizhen oph Cccle 5
60
Coela
t3 tntmeclat
id|-
t3
tI 3 t2a
3acdaes the is fon teueal Comnon
y Most
Coele
ocde aclene
Thnee
psasuntabom
pieaaes generahn Intemecliae
code
fpoan tget intotanalak toGasy
ererahn 4:Intezmecliate
Cocle
Date)
No. Paga
lOMoARcPSD|49086899
lOMoARcPSD|49086899

Page No.
|Date

Inteamecliat cacla
J
Sealloo)
t3tt jd2
3

fdl id24t
Cace
netemedias
inlo seuene at
Cosle instucben ane bels
machine instychom

iq3 60-0

Eis Coclegenersbs
Ric3

ADO

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Page No.
|Date

Context obot onnpilez ousins af onbil)

preocessar pacue inpat


to Gnjilera. They may
penßam the
tunchios
Macao Aocesingi Apane
alla
Contale
Fle inclusimiA pepsAi
inclucde baeclefles
Assembler

ag te file <glabelihz t
Relocatahle objetCocle
J #intlnla <Hosolhz ten it
ictaies inleoae feoles e file oaintis
cyed fles
3. Rahiansl peepancasei these
pbsode Machie pascessa gmet Dlelus
Cocle <anguayes 'h moe
danguags
mocde a ckontal

frocesig
ÞroceKoKA attemst
acle capabiltie, Zo te

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Page No.
Date

onilee
Sitien in
wsitten Aouce Rangusge and toanslse
tnto am n epuvaleat pruanintyet
3 Assemble

oganCmnememi)
mAchne
as am
Cde

Linko
Linkema7es
Soenaliles a
neloatablemachini cole
Anee fles
eesal
files

Loac
Takingelolatblo
Aeteig the Aelocatabb acderen
3
placng the alteea nstuesad ancd data
at the prapes docasa

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Paga No.
DatO0

Thexe
NEA o DEA
Cenueasin4
O Couet the given EA o DEA

tat

22

s3,0) = C22]
(e,2]
The d tanstiey fa is ostincod ay
S920)z

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Page No.
|Date

L,2]
Stat

(2,2,1

t
ne elimnte
s

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Page No.
Date]

DHerence blw Singe pasa _NuehipasGnpiles


Binglepass
lonhileeisa
Aome pessonbilea hst A muh pa
pasues tagh cele a abstsact
Code o each ombilaton ae&sa
unit amy heenal times

9:s faste thon mutGpam

alsD Called nanneo wide osbile


Ganpile
langike psal lan lay, Jaua epurea a.
Lnpleented ulh pss

GAs pass Lonyile


2 2 Topass corpile
3 Tn hemental opiles
aue ode CanliLes
hoss ompilez

Downloaded by Harry Jon ([email protected])


Downloaded by Harry Jon ([email protected])
R3 d bu
R3R2 MulE
32 Mov ic
d3 R2, MoUf
dy R,MoUF Senantc
anss
caion (oce
jels
2t2 idlil
iato Gde
t3 ide tye analyhs Sax
t id3 t3-
alya's lexital
medi state tt for
s af phas
es al-e athut
ot Wite
|Date
No. Page
lOMoARcPSD|49086899
lOMoARcPSD|49086899

Rele a lezical Aalysis

Sor lesual Tokemy pase


Analipeska
Get net

Sm

The lexial analyo isthe fzst pháse of conpilee


main tsk is to adte inlat cdaacters amel
pocuce Aepuemce tolaens tal the pe)
fo
On et net tokem'' amma

enit t ca te nettker
destfy ta
leal amalyy also stibby at comnens
lwhwthace 'n the fm a Blanks tb, ane
nenine fom tte
Characteyfom he snue

Jaken, Petten l exemes


tToken Collectve
Sepuence ot chanacte hawig
token

A St ot stings in the inout seh the sa


Tni's Rat st su
toen is prochuel
descbed by ule lalledpttay
wth the tore
Downloaded by Harry Jon ([email protected])
lOMoARcPSD|49086899

Page No.
Date

The BepuenLe 6 chanacte i


lem
athecl ho tth a pterM fe a token
toxone
Rate Ore,tl

fxamk. total

dexemes f

denem Kongtat 4

Totens
Tartal

Sum Token allea

Tnþut in Coiler
leriae Qnalyre oads the dua puSam
charscte by charate m the secomcky
js Qy Ihfoe
6)oys a clta is fist ead hto a bules
anc then Sanned y the ei Cal anlyzsk

pta

htialy
input
Downloaded by Harry Jon ([email protected])
lOMoARcPSD|49086899

Paga \
Datel
bbte

fPmiYes aheocl to finch enel af lexe


ASA O Blank Spaa is enConneit incio

and And
ter mnaben pant
aHe mainly to techniçes fo
sheme)
Sentinels. Ctwo buloe sche me)

Bulstses pours
halues
chanate,

Val ule nat e

Loand punte
puntu fp) is a en af t hee

Downloaded by Harry Jon ([email protected])


lOMoARcPSD|49086899

Page No.
|Datell

2). Sentne)s.
To o enCome His o te,ts we cclod
eda e chana cdes at th enesas
dent'nel, The SehHnet Is a fpectal char.
that Cannot te part afac psaa
So

a setinel lcof)
A mtural chateis es
E M eotC *
e
bler

Downloaded by Harry Jon ([email protected])

You might also like