Princ iples of
Co mpiler Desig a
A ssid mew
P. Samanvithal
VIFCSOG4
WUE cse-n
BharathUaiver yey
Scanned with CamScannerjInthar is a compiler?
‘Lid um E> €44/7 1TOTRE(e Fay
A compiler is a computer prog
naw hak tvawslates Computer
code waitten fn one Psrogrammi ny,
Lanqvage to another lan age che)
Source code frew crigh lever leunguog
ver
to a tow Level Law
Drvad parse trvee fre i/p Shing it tA be
id
Foid EnEGT
Toe Eat
T3 TF eat Ge
THE
Fatid
[alhatr ove the matin parla of compile
Inthat ave coumivs of Compiler?
the couivs of conyiler au.
1 Loader
2 hnkeibor
ZB. prep 70 e sv"
Hon? wthat anc they pervborming t
LA and Synthoris wre two
pare of compilakt on - :an
Jor source Lode - =|
SBynthests pare comtrauch deine
-d target paognam from iMtewedi
oe nreprrsentatio -
‘|hihat ane typos of qrammart
The ane 4g. typo of qnammar:
t Onsrestrni cted Gavan ar
a Context scustive ammve
3 Context tree gaammart
4 Regular grammar
Oe tT
| Define Parse tree?
Parse tree tS an onclerred tree Sepa
Léents syntactic ghauchune ob & Struc
ture ob a shin cacueading to some
Context free grammar:
hihat w Symbet talole 2 :
S ol Fatle w etcated by cowpl
tet in oader jo Store Mhoomatirou
about ocCUr4encts of various enti} cs
as object - has jfunttion ct c
Jtrthat Kw lexeme 7
leone ae eo of
character fn sowie program that
maton the pattern for a token
amd ideutific of by jeicak analy Zex
ab on instance of token .
Scanned with CamScanner4) Devine requlan tet?
A ne that denotes the value af
suqulan expression iw catled peqedany
see
to} thihat arte lssucs of lexic ab analy Fur?
A. LE Ffcceenege of Compilation :
of compiler B enhonced
b. paltabi ut
4 is wsed to Speed the
B- bubbeuin
compilation
ie] Define Hanclle?
4 A handle ub a String that mat ches
slot Vide of psoduetrm and whore
reduction non-temminal ev tht
Gide ot production presents me
step olen4 the riewetse of A aight
most devation -
2] Define Operator Gvaumman?
oO, A ammenr thar b&b wed
to debine mathematical operators
is called operator qramu on 6
operat ox precedence aun
Bt hthat ane drawbacks ab Le pamey
4 plb we too much work +O construct ®
Le Powe by hand.
2 te meds antkorn alkeg parser
gene .
ta ih
Scanned with CamScannerS-1F anna cowrains Squad |
owl ihe =
Thun Ke & otitHourt bo parse iquitre,
Iq) Define LR) thems?
A) A LAW) Hen & a production of &
mar with exactly ow dot on the
Aight hand “de For cromple 15 Te
| teads +o To -TAE) Taptep , Tote fF
TOT€E
5) Detine Left Factoring?
A HF omoac than enc Vom ah producti
Puly has common prchit sintug, then
top cloum paver cannot make a Choite
Me vohtoh i producti it ghould take
Hy parse the Shing in hand
Ss
Lok tree Kinds of Mbernediote Apres
‘eytokien4
1 Stuckwred i
By 2 Flak, tuple base qenurvatiy tae
addi code
3, Flat, shack based:
. votabed Parse tre?
Lan ““ a parse tyee Vhowine the
A. alu oF attributes at each node -
valu . i
g [rie procem of computing the Obie
| dues of rode are coled anyoraiing
parse, wee
Cpraphe ov tvee based )
Scanned with CamScannerWjhthat ane advaret age of gentrat
-tng tutermediate fepnesentanwtt |
A.|) High level UR °
4 Lew vet (IR |
3. tb cam be eithev language ep |
‘endentCcode for java) ov lange age
dependent (three ~addaess cocte )
ta] What ww various wuthods of tweP
~lementi three addres: co cle 3
Ay y Quadruple
&% Triples
3. Indinecl tip .
a} what is Bane Block?
A-] this a gequenc of Statemert: the
Htovo of vontrel enteu ak bedinnl
of Statement and ave ok end
without any hath -
gil Wthat ove sues im design. of, code]
vrrakoart
Ad polnpuk code qn
a. Tange paogram
8. Mews. anagem?
4. Reginter alle cation tsuss
os
Scanned with CamScannera} that ane optimiding cowpiler 7
A|lE &B aA Compile that Anies +0 mini
mi%e or maximize Some attnt bute}
oy A executable Compute program
a3] Give the cruiteata Tor code —wprovi
i Hrawsboamation :
A e transformation must prcsowy
the meaning Of programs. thot w
the eptimization must not change
the put produced by the progeny
fon qiven imput
Hl Alhat B inpul of code generator
A The input ia the interme cake
fo ole qene vated infront end along
wath tnfoawration in the syabol
Lable that determing the
lime addres of dake objects
45 Lost addr modes?
a Register indi vect mole -
2 ister mode ent |
3, Auto Increment (Beem
mo he
i peek HAdnovingomede
5. Indirvect Addressing mote
Zw placement Addrening mode
\e
~ Scanned with CamScanner4. Relative Addnewing Mode - 4
¢ Base pe Ainicert Addnewing Mook |
Scanned with CamScanner