Download compiler design handout and more Lecture notes Compiler Design in PDF only on Docsity!
©
COMPILER DESIGN.
Fenibe automate for the fit bring
ithe CThe mpson's Construttiow )
made by aol in Protersing
Conskruck hondeley ministie
vequlay expressions ding Al
Show the Sequente oy mov
the inpoe Skiing ahakbbak .
@ Calt)*
ch) { at] 37)”
co) (celayb*)™
ca) -Ca\b)? abd (41h)?
Solubior °
el : +
Considevy Y= Ca | b)
a oe ey, 2)
Nox) 16 Non) '4
e709 pee.
r™% >
Ca.
* %y > alb
N (4a) 'O
s tv) i. See
NW C73)
)
Ky a meves
ee
S =
O4t 97273 pa aes 6 ete
%
Jai >t we hp eet ee
Sh os"
= jor eer.
por abhabboah |
cay torcrae oe Cat ey
%
Vy: (atl h
Nea TS
@
() ConvevE de moat
Fa’s ¢ .
* ~ Probl ; , .
Alaevithm C Subset Algeritim Shoes ed aes using
reves made by eden TY prptersing the
SEving Ababhbah . inpok
Solution e
(ay NFA sor (aln)* €
Shaye
. €
e Fist find £- Closuve C50) Where So ts the Skat Shute
ee NPA.
Find &-closuve Co)
€ - closuve Co) sferua.4 34
e initially , é-Cloture Cfo) Pe only Stabe in D shubes
and ik fh brmarixest .
- The Shavit S bebe oh the egpivelent DRA fs
e-eluvane Co), mew se AS Ye eit?
¢ The mpuk Sgrobst al tehe E heve i's fa,
The al gentiens tell4 vs to mare A ond thew
Cems puke
Fivek E - Clotuve. C move. © A; a))
Stand € —Clswe C move CA,b)).
4s
Fivst Compote move af he ©
Set as S baly
ay
mmr CA a {3} “ein tromsi Hens ae
VYorrw member “++ A
° there "oe Suck trans Hon
& -Clauuve Cmove CA,s) ) trom Akko 2 & 3
= eee
f 4%, 3, 46,44
B
Dhran [ae]
n
iw
iM
. Coy pube move C 4,4)
move CA,b) = ps4
* & =éleswe ( reve C#,4) }== p34 58,74
2 ¢
= Dio, CA,5)
e Gropu be move C®,a) = {34
é -Clusure ( move Cm, 59 ) = f 1,2,%, b, 6,74
= BR = Dher CB,4)
move CH,6) = fsy
€-closure ( move ¢ ,s)) > frs4, >, b 34
= C > Dhew (4,5)
move C¢,a) = $33
é-clume Cmove C¢,2)) = B= Dhar Co <)
move CS, b) 5 f 4 .
E-Clriuce { moveal?,e) = ¢ = Dire Ce, ry)
Trang: Lion Table
aE.
Tvansi How Diggre—~ CpPa)
ho
AVRO FTRBWCVO DEAS
a b aq b 4 a b
Cb)
NPA der Ca*]b*)”
Re fev Presb No ©
Fixt Compu be é-Closuve CS )
te €-Closume Co) =fo,1,2,3,5,6,7, J, lo,l
= A
Heve input Sprobst alpshaheb are {«, 64
move (A,«) 3 {44
€ - Closure Cmove Ca,a)) =
j
U2)3,4,5,6,7,49,10,04
+ 2% = Dbran CA, 4)
(a)
NFA doy Cale)” abb Calb)® Redev priblen®
» €-Closuve lo) = fo, (2, BY =A
- Tnpok Syrobil alphabet ave (a, %
move CA,4) > 43,83
é -closuve (move CA,a)) = f 2,3, 4, 6,7, J
B
D brawn (4,4)
bop
“move (4,6) = fs
Be eleswve ( reve C6) ) = Pipe, 4,35, 6,3)
2 ¢
Dlraw( 4,4)
\
move (8,0) = [3,83
€- Closave Cmevel,a)) = (i.2,3,%, 6,7, y
=
= Dw Cd,4)
move CB, b) = L099
E - Clesuve ( move C%,5))
J
{u2, h, Ss, 694
W783
move (¢, 4) = {3,¢}
€ —~clusuve ( move Ce,a))> fv. 8.4,
= hee (Oa)
move (6,4) = {5}
€-closuve (move (2769) = Gia ,4/5 & +
é ( )
- Dear (6,5
* move Cd,4) zi 13,84
E -cl swe ( reve Cd,4)) = 8
= D brew Cp,a)
‘
© move Cd,5) > j 5,104
é - Clusuve. Crmove (0, >)
wow
p fyr,4,8 @
7%,),10,tt,I2, 16, 1B)
E
Dhan Cd,h)
2» move ( F,4) = S38, 134
E -clusuve (move CE, 4) )= >
move Eyb) » fs, ' ey
€ -Clusuve ( move Ce,4)) >
move ( Fa) = f3,¢,133
é -clssuve ( move CF,a))
~ move CFDs £59,159
é artuwe £ rmve CPrb) ) >
fi,3, 4, 4,7, 8, "el® (13,14, 1b, 18 Y
F
a Dhan (£,4)
{' ri,4,F 1b, Myth y la, 15 16199
= D how CE,4)
phew CF/4)
O2,4,5, 6,7, 4, te ie yh =; OE
ae7
Z H
= phar CF. 4)
wrove (4,4) = i 3,2, sy
E -cluswve Cove C5, +9)
meve (G4) > $5153
6 close C move C61,4))
meve C4) = fs, &, 3)
é_Clusuve Crmove CH, a))>
move (#15) = oo
€-clesuve ( move € v.b))?
wv
”
uot
F = Dhe~ C&,%)
Qe phow C4, 5)
> Dhew C4)
S12, 4, 5,6,7,l0 t ALN IS,
I
16, 1eY
Dhaw ar b)
~ move CVA) = } 3,8,13 4 @®
€ -clusuve Creve C1,6)) > Fo Dhan CF, 4)
s move CT, 4) = Ls sy
& - clutuve C move C£,a)) ~ G2 Dhan CF, 4)
Transikion Table
a
Is take
a
A BR c
B B D
¢ B c
DB a |e
Fol Fp |G
F F fm)
GS | F 1G
| ele Io
I F G ASBRODZBSDSESDF WH
a bk & b bb a &
@ Construct Deals for the regulay expression Iv problem © vaing
the Sixe # the Drals with those Cmsbuchey
Algevithr~. Commpove
for nodes iw Syntax bree
jw. probler~ @ iygtpos and leaky
, mee Coli
® (als)
Solution Tn.d 3%
Vv: (ajb)? a \
> a &
ve = (al s)*F Raehiey {3} # £23
3
ty] Lay
ty
fr aft fyb fy
) 2
© (Celayst)” Bond, gay
Solutow
# * F524 F f
v> (Celaye BF HY
(cee) yy,
V# = ( (ela) 3")
FOLLow Pos $y 5%
+ A = {a0 y
a Posi biow 1 tov
a
> = 1 whe
folluepos(') > {1,2, ay > A > Dt )
-y positie~ 2 tev 5
SsUnvpes (>) ~ (12,34 2A > Dhow CA, )
T ‘brow Hhagrery f
4 TranseHow table * Tremsibo 7
: . C)*
[ Snpok_ chev
Srmre (a)
wz
bet.
+ wing Subset algorithew * Heve alsc ne. ob- is; £4
Chk LAIN Subset liad
"A move te pove-t BS
th no. f Shebes &
Tremsibhien iagrenr~ Sh fuined
Id gn -e_
(4) Calb)* abb Cals)*
@
vhs, Calb) # ab (Alb)? #
bade 644
_— LS
foe, a9
Sina {x4 tat 44
aah, i \ Ae L429
Jf is b $< |
=
fray, 4 fat
JN
{ind # Sin} fx} * iy
| oe)
gh ay 4b $9
NODE fortlow pos
$1233
i: gues)
3 443
{s}
4
s { 6.7/8)
1 Gee
1 | fered
bp le ee
+ Nw Considev Bs,
follow pes 9 vu gollue
dow |,
GU followpas Cw) +
posih Hew 274
tolluw pas
As] on)
fj b Tr
4
buy a Ly
&£
faye 13h
w~ 1,2 dor
foallowpes© VU folluep
Gia3e
A <
A
iH a i”
> Post ° -
= 8B
= pivaw Ca»)
few b
y 2,34
> positow ‘a
tollue pes Cd = g
4
phe~C a,4)
U,3 tov oO
= £42,344 2B
23,5 4% S @
= phronlas
posi ho
pest? =p baw
L y, a)
Marit dint S
posi tio 1,3 pov &
i pkraw (¢,%) =
> pesitior us dev b
pes @)y Vv 4ollow
follow
=D
= peeow C675)
# Consider D
7 position 13, b for #
follow ww pos 1) Vv potlowpes O20 U follow pes (6) = fa, 2,3 (4/594)
© pen (D4)
<p posikier 2,7 dov 2
F ellaw PB O?Y gollewopes 7) = Ce db G
=D
= DEra~r (d, )
3 positiow
- pn brary tE, a) = E
4 posifor a, 4,7 tor b
followpes > gotlowpes 6 3 oll oper? © Let BP, Get way
°
= th brew CE ey)
a Consider |
—— oe
> pesifor 1,3,6 tov a
piven CFA) 7
-7 posihor day SF tov b
oy pollownes ts)? got loo pes (4) = $1,2,3,6,943
> D
nn tyansikiorw Aieg
@ Catsyt aby Cot”
Teh ( a
Transl ew
R
8
B
6
F
Pp
Fe
fe
a
g Trike a~hHhow Ti AS
Lick pavhh n Cunsish & dno groups ®
) (eGna) — actepting Stabe
2) CA RoDR)e- NO accepln Skee.
e Cmsidey the tive grep > Ce Gr)
> ow I/pe > ev eb there S bers hes ~ dares He ts
FE ig Cath A fre mewn hes hy a pep
jo +5 Sacre stoke 7? spEk /
Thay Trend, * Ceo43)
+ Const ee Stk GEE panne
- ow Tipe + Hebers #OCd pe eC
pe, Aart rer :
Skike F Gos ts
ottev rt)
~ Caner) (FP)
Tne, =
ce ¢ ao bay t pla
tee Genie CAE
fo M bev Th
C - enn
oo The & m7 stokes AP) vr Sac POP
— 5 Je to pron hev
rr @2
- Tram, 2 CAe)C a) CoP)
Sy New Consider (Ac)
a
cw Tipe! aw ew Tp 5’ wy both tales 440 Ge &
Hive. Alebe -
. no 6phkE
Trew, Cae) 6) 0) cr)
> 7 Cad) cn) CF) C293)
Ly |
A be phe epee ee Ee he the ¥ ee
¢ 7s
Stake
am oO >
“it fe. oe LN
Ty IN pa Ol,
(4) (alb)*a Calb)(alh
1 Cale) a Cal b)CaI4)
v2 CafsytaCajsp(alh) | ae = Calh)*a Caib) (alh) #
Oy 5}
Prins
Wa ko ia Pe
7 > fast NOt
£1.33 vy, Sb, V3
tan i
JN 4188 ps bs Buse
firh S23 Beha Masy ‘ is}
Ca Ss
$124 | Lind
PLOHE Lp $04
{ 2
NODE mses
! 342,33
2 fririay
3 f4a.s¥
F133
= fur
b re}
7 fe3
Cg —
|
= tet fle fia, 33
a,
~» Pos} Low: 13 for «
Follow pos (1) U Followpas C2) 2 2,8, x} =—27
+> PosihHow 2 for b
Folluw pus G) = fr2,3¥ = Ae dkraw (4,4)
* Comsidey Be $123,454
= Dbyan 4,4)
> poshHow 1,34 toy a
Folluw psd UO follow pusls yufollcpes Ce) = f 128 M3,6,7} zc
> dbran(Ga)
> positive 15 fov b
folluwpas (2) U folluvpusls) = { 12,3, 6,4 4 =D = nbavin,s)
# Consider C= 102/3,4,5,6/7]
> Posihor 1,3,4,b tov ©
: Followpos GSU folluwpos C23V follupus Ce) U Follewp ut (b)
= {vray 45, 6,7,8} - £ > Devan (6,4)
7? position 2,6,4% tov
Follavpos G) U follewpes Cs)V Felleopur C4 )
= f 12,3 ,6,4,¢4 2 fe D bran C¢,4)
YH Comsidevy d= S 12,3, 6,4¥
D Position 1,326 for w
tollowpos Ci) U folfuvposC3)U follerpos Cb)
= $12,345,649 =G- Dtran (5,8)
> Position 2,4 for b :
doll pos(s) u tollewpesde) = §1.,3,e,2H= Dkre~ Ch, 8)
Comgidey EF = $1,253, 4,3, 69,84
-) Posilion 4, 3,4,6 for @
Dtraw CE, 4) - £ .
2 Posi 2,5,% div b
~- Dkvew (Ce) ) =
@
#® ConSidey fF = $1,2,3,6/7,83
oasieey Ps eee
Transitiow Table
> posihe~ 13,6 tov &
_ Dla CF,2) 2 G
2,4 fov bs
ptr CFD) *P
dey GQ = $1,%.3, 4S, e}
+ Posikio
x Consi
> posi how 3,4 dev “
_ hibzew £45)" §
spake Gs dee P
pte C95)? D
is for ~
. posite "3 -
, piven Crim) =i
b
» posikee 3
> posi teow CH) > A-