CC 3
CC 3
Ddi/e
A;E/E
A {bia
E Bla
Augmente4 goammeris
IO
s'
BbDAe
BboAe
D’ Dd ; 3
II goto (Io ,s)
4
5
6 I23 goto (To.B)
E B 3B.
a 8
I3 goto(Io,bb)
B’bDAei
D ’ Od3 bla
1 bJa
14 qoto(3 .o)
BbD Ae
13:
AAe qotol 16,;)
D 0d ,albld
el;
J14 goto (11o ,o)
e;
E D ’ Did
B b DAe
eli A
A:E
albld
el;
e/;
ele,
IS: qoto(14 ,A) el;
BbA.e B, elj
B bOAe ,el:
el;
16 qoto (4,d)
LIS i goto (I2.E)
BDd; albld
It qotolTt,¬) goto(Ii2, 8)
AE , e/ qoto(L12 q) 3 19
I8: goto (I4.8) goto (I2 b) TIo
I9 gotolT4 , a) Îl6 tqoto (I2A)
Ea a/; B b DA e el;
II0 : goto( 1b) A A )E, el;
boAe el; goto (II4 ,d)16)
0 4.0d ; albl to CI14 ,¬|I)
albld go to (Lis,B|L/
Dil: gdte (Is e) goto (I is, a )"Ig
B b0 Ae. goto( Ii+,Jeio
LI2 i ge to CTES,;)
atbtt IIgoto (Ts, e)
e/; 6-bDAe.,el;
E
el; gpto (1ts, ;)u2
eli
BhDAe el;
and IIo
here .I3 |4 part
,24 and I some. Coe
IS and I|6 ane
and I a
I 8 ’ b . OAe a/bld
.
albld
I4|4; $fel:
B- 6Ae .albld
glD.d;
A’A;
el:
A’
el;
&lel;
el;
BbDAe
ISJ6 :
A A. ; E e
State Action
d
33]0
accept
2 414
SIG
414 53I0 S6
S)6 S12.
6 S13
RG R5
R&
R2
S9
13 419
R3 R3 R3
RS
SHI¾T REOUCe PARSER
2.
Redu
error
&.
4.
aciept
shift achon
shiFted into stack then shift
IF input is
i6 taken.
Eid
is id tid+ id
ohexe sing
shif+
input shift
stack idtid t id Redue E’1d
+jdtid
did shift +
+id tids
shift
id t id Redu ce E’id
sE+
$Etid bjd Reduce EEtF
kids
<hift
shift
id
Reduce REid
2educe E’Ete
Acept .
S o sC a Ac
A9 bAlab
shing aaabb ccc
Stack Aectnput actio n
caebbceet aao bb cCc shift
Ga aabbccc shift
$ad abbccc sbift
Saaa bbccc shif
aqab bccc shif+
saa abb CCC Reduce 9-b
$ aaabA CCC Redluce AbA
aaoA Shit Sate
qaa Ac CC Red uce
aas
$ aasc redttshif
educe S asc
c
asC shift
S asC
aSd aAd accep
5A bAcbc
aa bbccdd
otack input Action
aa bbccdd shifh
abbccdds shiF+
daa bbccdds shitt
daab bccdds shifk
$aabb shif+
$aabbc cddd Aeduce A bc
$aa bA cddt shif
saab Ac dd A bAc
saa A dd s shift
as
sleduce saA
Shift
$ atepteduece sHasd
acept
S’ aB| bA
A’ alasl bAA
B b| bs aBB
baa bbu
asd loAd
Stac< in pu Action
baa tbas shir
qa bb at shift
Recteee A
A ba abba
shift
bba
shif
$ b aab bat
shif+
ba abb at 2educe
baa bba Redu(e Sba
B9 bs
$ baabs peduce s ag
baa B Redue
¢ bas
Aas
Reduce Sbn
bA accepE
Opesator Presidence Pazser (opp)
This i bottom: method in which we
indadte neloions between operato5.
here
oxe 3elations
< (less thon)
> (qreate thon)
Cequal to )
iS on eepression
c there is 0tb*c
beLe
hese hos highex precidence thon t.
elaton iS tK* t
-''(eaual to)
I# tuo teminds are sepoadted ty i vanriable
then use'= relatioo
- for example -
SaAb
here a ¢bb are 9epazated by A
do there is ''gelotion
id >c
opp for t , - * l T , id
drdw
id
< <
<
<
7
eY <
<
< erro
qiven steps to check opp (no+
,.frding lending trailing of all oriales.
,.And al pairs Such that a terminadl followed
Waoidble Vaiabe tolloued by terminal: and
by step 00.3
apply
Note -
1f ther e ane more than d entries io one cell
then grammer is not opp
id
<
<
<
7
id 7
<
draw opp fo
+ s /ss /id
Leading
t,ids
Trailin
J st 2)ts 3) s , 4) *s s) $$ s 6)
id
7
<
Not
11 Cs) /ala
Leading
2) T 3)CS
4)s ) s) $ 6)s
a
7 <
7
7@
<
77
L +RIR
Leading
Kt,id?aaj Troiling
Que.
LI+* ab
1d
b
7
not Opp
frs
code.
and Pseudo
digrorrs
Transition
2 idenifers
3 number
4Telotioral cperatozs
lor keyo
Fa
draw Trarnsiton diagam(d
(f else )
Ele
ele
L/1
slsa identifers.
transition diagra m fo
Que dvaw letter"aiglt
4
()
Pseudo code for kwid mTelahond operato.
Stdte qo
C qetchar C)
then
goto staFe a|
else if Ele the
then gote state q4
Stale C-getchar)
ql
goto Stte q2
ese errorC)
State q2
c getcharc)
as/delimeter!
FCe = getchrf (
then
goto stahfe q3
else
erYoYC)
state 93
retraCHC)
ehurn (teyoond LE);
o ldenHfier'sletHer/
tettey digit
stak 40
getchar c)
C= lettey the
oto 91
else
stale qi cgetcharh
ite c 'lefes ldigiF Fhen
goho stat q2
elre
errocO
stak 92
retsact
Pseado
q
TehivnChdenhEi
code for nUmbe
er)
Numi Numbe
(90,
92)
Gtate qo
IF
gtchax();
C NumbeY then goto state a)
else
erorc))
cgetchen),
if C Numbe
else i Ci US
qoto Shate q1
eseractc);
Tetuonlumber:
a keudo code for elaion
Directed Acyclic Graph
)
(address cocde
In this block 3
we have
to
epresen+ qiven bosi,
given graphical form
bloclk into
2) TI BCi)
T1 : B * C
TI
draw OAG or
T2 CCi]
T3
T4 T2- T3
TS T2*T4
T6
T4
)T3
T,16
Que A
Gd
Ct G
BT6
Q.
ts T¢
12- a+T1
T3 = e1
dt T3
Te:tT4
T3 t TS
FAG
Oue. praw OA G. for
given
basicbloclk n0t
Jn this case fo the give n exo
quadsaples Fo
we Constouct
erpes
columns opeTato
A Quadsa ple has 4 esultname
Opesanti operand2
3 eetm structure
Toiples has
operatcN Oberond operand: 2
A TI
T3
T3
TS
13 ^G
J3
ts
T6
T t TS
T2
TS
(4)T2
T3
Que a-b
a-TI d e AtA
T2-d *e aFNq
T2- d e A T3
T2-d T4
TS
T2 TS T6
e
Cat ) t Carc)
caw JAG fo
bt
nesult T2 t Catcod
o pe Opl 6p? TI
C
b
T3
cd T4
T3
TS
T4
T2
(+ TT3
T TS
T6
TS
ivected fination
De
ynlax Csoo)
opimization technique
This is Code steps used
To dadw spp olloing
1. oite Symentic ondlyss expYession
fox given numnenical
2 coaw SDp
daaw spp fo
¬ ’ EtE
EEtE
E(e)
E id
Eval S09
Gyal E-vSo0
lexual E-ualSo
idvalz0 dlvg1'so
¬t E/ E E /id
E val : 79
E.val=?t Eval =s
Eval: 9 idlv=s
id.luzg jd.lv:g.
EtT/T
E’E+T
E-vdl ||4
Eval g
E id tT
E’ id t id id Aual:9
id.luzg
E+T
E ’ jd *id tr
e d *jd t id
+
EsUal. 6o T-val. I3
T:val: 2 Fl Fval 19
Fval >(2 Jd.luzs ld-lu13
jd.lu=12
.g) E ’ TE!
El + JE/
G TE
E’TtIE
Ce) 7id
t id +&jdid e
Bal49
Erval
Fval g +
Eval=8 T).val:4o
jd-lu g T}val
id.lw * Eval:
/5
jd.lv