0 ratings0% found this document useful (0 votes) 44 views16 pagesAtc 4th Module
Automatic theory compilation module 4 full notes available
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
SURYA Gold
onl :
> | Betton -up Paving :
Vo Shift -veduce Patuses fe |
f& © [Considen the grammar dov arith etic © Prey
00 tony ——___|
Go| ES E47] Let_wo- td xid ~
| TOT E|F
p> CED id
oe — put
xid 4 Reduce by
Poet
ed le
‘ids ShibeE
~ [gt ‘dd Shite
gt¥ id $ Reduce by 4
THE $ Reduce TXF37
ee 4 Reduce EDT
E & Accepted
ithe 4 basic Junction of shitt-veduce parsey
1 Shite: Shite the next” mput symbol onto the
_top | stack. : 4
| Recice Ud) the handle ap on_top @ the |
sthek then yedute it by appy _non- |
teminal - ae
Stack “contains or
= bulle, dy cel ie act
Stover a Syntax ior & falleape 4
aa
"our ee router
sy m
Acee pt8 =e
1 > Inet | dloat
——inp Action
sr egint id, ide4 shies
aids 4 Reduce by
> 7 ee
gt _shitt i
[eid a reise .
: Lid
¥ap BibeZy Redutezen
FBUL
$Sb rid: $ shiet
atl id, $ Rede Shite
$7, id cf Redute by i
L>L id
$TL 4 hice ©
Stk: 4 Redute by
| eesti
gs $ Ageepeed 5]
peor _ shit ‘veduce paurin so TP
skying_ fa,fa,ary_uding! gvarnman __
Eat Lsja ai : |
ye
E ee ele rs A
Zen
Iry Ui ct Duuing ShiH — Redure Fousing _
Thue ane some grammars fey Which %
Reduce pausing (an Yeah a Conji iguyation |
dohich pause’ Knovsly the entre Stalk
|fentent & next —i}p* Symbol Cannot decide
uoheHex to shift by wedure His Conflict cu _
|_dettches —cwoherther — to shit Called QW Shit
teduee Fasuing
tuation wheue Pauses cannot
resolve _ which of the Seduction to make>
yedute -vedute Con} tictOF
pov t
else Qtarnrras
the donglirg
ac = consid
gtmt = oy eapr
[42a
omer
Hen stmt
fren simt
one Stmt\aloa\24 be
> Stems and the LR(o) Automata
\ How does a shitt ~ yeduce pauret Krovs Lhe,
reduce ?
An LR parser makes shift~ vedute decision, ey
maintaining states to Keep track of whene 4!
aue tna pause » States vepreserls Seta Of "ibe
An LQlo) ikem Litem for short) af a Praarreny
ba production Ls bt witha deb at Sore
Position of the body » Thus, Production Ary
yields the our
A> oxy
— AS xyz 0
he preduction A —>s qeneeaters only One Mem,
aes: yi ~y
x | Sntuiively , an item Indicates how mutha
lo producttn we have Sean at a given point
in the paxising Process.
* One _collecHon® e seb | LRlod items, Called
the (anonical LRlod collection Provides the
_basis for constructing a deter minstic
r ran } —
b - udinite Qutomaton that Us usec to make _
L pausing detistons» Such an automaton is
+—_falled On RCo) automaton.
To construtt the canonical LRIO) collection _
fox a grammar, we déine an augmented _
Lgrammom 4 +0 qunctons, CLOSURE & GOTO.
ods 8 peamenan With stat symbol S,_
}_Fren Gi!) the augmented gyammax For by,
} +861 with a neo start Symbol s' §
,
>S - ‘The puupote ef tha new _production ua to indicate to the
> tat
’ pune when it should stop poxaing & g
} announce acceptance 4 the input. That a,
] ace prarwe oceus .when a only when the
| pause! us about to vedule by sis
y
pa (los UNE el Stem Sets
4 ZT ws a set of items for a qr rrax_ 1,
} Syren CLOSURE (I) ds the set o{ iter tonite
{ . Py two ules:
m int to! cLosure(t)
—>% is
ro more new I
ta ule
: beatin cases
———— given below * low blo) Ste
Teaet_sAbo) Suter E
onstvuce +P LREOD automata ce
nas us
> | step: augment e ed “gram m
I Be
I E> eat | T
T>THXFIF
F > (E lid
stepa' Jind divst item set
stem To 5 eS. EG eaeeu es ers nee
—E>.E+T
E>. T
a> ATs EF
THF
F>-(EDY
F>.id
Tj = bioto (ToJE) shite the dot
laste (To, -T)= Tg
=e Z
7S er
taoto (Io, F) = T.
TF.
eo
(_bote(Ze, (= Ty |1 luote (Ty, C) 2 Ty
F>(.5)
E>-E+T
E> -1
yes lee
Tse
ES .(e)
r Fed
toto (Ty, id) = Ts
_F> id.
Gacte( i, a) = ee
E>ERT.
75 7.46
aote( Te, F) = 1.
— 1>F.
| wit (re Coie er__ SURYA
input Action
id xid& Shite tps
xd & Redure by
xidg Foi
Reduce ty
tid $ hilt to =
id $ Shitt te 5
& Reduce by
FSi
$ shitt_to 10
se Reda by
oo TS THE |
$ shift tod
4 Reduce ase |
See
$ Shift tol |
$
4
: df you wath E'_.
7 — Akg ih ie 1s
Te ea ret —pet Ud tyace the string Sd +id
1 input Action
gat! idtid shill to 5
0 rid $ Reduce F—-id
? rid Reduce T->F
a aig || | eee
1 a “id $ Reduce E>T
pe gene
68 | $Exid $ Reduce F
mh Exe Redeone srirtio 3
Reduce TOF
(oe J
ob 3 BF T=)
‘168! 46+ g$ Shift +09 ins
o164 geet
$E 4 Shift_to |
4€ 4 Reduce E> E
Accepted
I Constr ule pRIO) oY canomial li
ta fox the grammar
Land “LRU ed automa
A> (A he
ia ooo ind 7s 4
—_ $bem T=| SURYA Gold
ima
|
1 > E
1 | step 3° dJind ‘Ipsure (or) .generatel’ So! os
{| Jottours
a = 2 Al Pe A closure (AS
| >
: | A >
a j Ao
7 | thats (To, 6) = Le a
closure LA) a
| ASCH
AS 1a A> UD
(uote (Za) = +
A> a:
toto (2g. 4) = Tu
A> (4)Pause stving
(lad)
etake Symbol input
Ce eee
og $C os =
[oag $l 22h shift. to se Beeesee
feaaa |g tca 35g Redute by ADO
cag | §tCA fers “Reduce bys 4 >CAY
Poot | acon ie et rpg SL Reduce by A= UA
Qo | ACA >} Reduce by A’ >A
o. | 4|
, SURYA Gai
ers LLLDE SLE > 15 may ks a Gaia
47 Constructing Simple 1R (SLRD Prsaing tay,
yoo'le ‘
yo Agovithrn gen pat
expression
fx © Consider te previous « grammom, With 1p,
items & LRlo) automata
este at tities
© Finst (ED = OC, 1d 4
Fivst (TY= 2 CO, iay
L | Mase =o Cid at ee
[Fein SEE 9E
| Follow (7) = sexy 4 Follow (€)
FSREUSS, +94 -f3/4+,% x§
Falime(®) =f ELICITED| atu
toto
Action
apenas
i Sl
\ o\s\e\r ele eee
Fe
“Reduce the praductio
exten vend
shift ex =
Redure by F Sid
“shift to 3
Reduce by TF
shiét tod
shite te +
shift to S
Reduce by F idl
Shiet to lo
Reduce bY T
TS