0% found this document useful (0 votes)
9 views31 pages

Unit 3

Uploaded by

shaktigupta1011
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)
9 views31 pages

Unit 3

Uploaded by

shaktigupta1011
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/ 31

Rzlos]2022

UNIT- 3

Theoy o Camputatow
Camputaliu eu AutoyMata Tieny and fomal argusges
we
Stovted n 1959 with a
N
chmag
N. Chemsky qaue a matiematal Medel o ranmay . The metatiow

to study Gramm a
as Naturallasguages ike

We sthudy Grammnay to
Pavse

he Man at the kut

(S Sentene synbal ox taut

CHL

APPROA
NR VP.

-wol109

boWN -dn
NP

Top-

The

Passe Tree
Man at

Doi uatiiyw
Axt

the
|
Tree or
ovOdtt

syntan the

Deuiuatiow:- Reat to leak

aom sentene to Sentene hen


go

Sentarce o sertence

constutt tee ü bottom- up manne


Rules o Produchon e a ollaus t- (Rules

<NA)(Nt(M)
the
man
at
(NP (Ast(N2)
(Aat the

u a Helatiew (eits tranwiten ),


rkexuu or

<At <N) <Ve

Ata The Man <VP>


The man (V> <N2)
tte he man <NPa)
9 {At N he man at (ANE)<N2)
the he man at the (N2)
man ate the
>fut The

She One
he man at the

we aue able to douive thia sentee.


ep
aue to be onsdderd t

0 querdhiu
(9) (rammte
CoutuHn.

()T idi catu that duoutd all ad only the

Setones to that

centonce.
wldh campoe the

(ramay 4- tuple (Vw)T, P, )


), s wheue, 4

set d uauiabtes | Non -enals.

|T» kitt set temi nas fuyput

P fnit et &e prdutio fules

S Staut

(Tetal alfiabet) V- (Va Ue)

Non- omi nals an be


be guiter
guutten a
as somethung ele
Tosminal cannat be rauuten else.
soneting

CHOMSKY - UASSIACATION OF GRAMM AR

Reuslve umerabte tangge


Context Sensi ttve

Regulas

Coutext kaLe
CrammaY

Cprammar -CsG ipel

REG ype o {Unotiho)


A XB.
ABx
leyt lniar

whene rammas.
Rght lihear
BE VN

that eth lneae

but not botw

A Baa
A asf a aneta guar qamma

Lineax Cramma
a can BccU On he,
(amma in whicu atmost ne uauabte

ade witeut eti chon on he poritün


Tgt kand productiu

thi vaiabte

ABaa yi a Linea franmay


A aß a

Cotut fuee qama


A wheue A € Vu
lype I or Contert Sensttve Crammay or

V*

fud e
A c Ba
Spe-3.
B abc.

SASB
alA
|
d

.
A

saslab ype-3

* Nato

The dee d e3 qmammor


the tokens, idertlfes and'epetos .

S aA
S Sbb| abb.

AB

L
-set
Set d all stings lengtu ateast 2.

L (atb)(atb) (atb)*
5 AAB
Aa]b
B aB| b8 E

L= abmost tuo

Stt L> (atb+6) (atbt€)


S AA
A a| b|& ype- 2

L anbm
SABaA
A a

BbB| b
S asa bsb|C

Satbsa AB

Sabstab tasfta

A abA) ab
B baB]ba.

Sasclatc

A Ac ae AbA|b

Q-12
SAB
BbBc| be

S AB

A aAb|ab
BcBd| cd.
S> AB
A aAb| &b.
B CBd cd
Sy aGd |acd

L-ebick| i j+k}

ak a'bic
Soa c
So S,

S aSelaBc|e
Ba Bd|ab|e

L• fa'bie lj i**}

ab |e
A aAb
B6Be bc |E

Sastte
Sj AB
A ABab' aAb|e C a C|e

B Bee
FSA to
Kegular fuanma

final statu

stat

A aA bBb
B aB] bB|a|b

(2
(0
B
A

A bA aB

8b8| acla

C bcb

Keqular ymmay to FsA

+)Aia to ome final ctat

a) Aj aAj

S(Aij a)= Aj
A

BbB|
bA] aB|

b.
a 8 A
,b.

A
As
-8
:
per Rules

a A B

A aB bAE
BaC| bB

Q
B

A aA 4S a

ajb
Staut it a uiatio
o sentene, then

Deuivatiew (an be LMD (Let Maut Deuatiów )


(lgdt meut beiuoki)
LMD
at ca step i a doivatieu, a predutiow is ayplled to t

most vasabe ) then deiuatow u caled LMD.

RID
to the
prduchiu à applied

denivate s
À (alled
called RMD.
then
gt- mot uauiase,

eq Considou tiu quamnaY


and a out )LMD RmD
3 aAs
Sentertial
aAS ASbA$S| b a
(0 LMD: 5

3) asbAS

aabAS
aabbS

aSbA S A
aa bA
a ba
aabb a

S aAS
RmD:

asbA a S b

'asbbaa
b
aabbaa
(onsder a gamMay and a stoin wz bb aababa
sting

98|A fud ()LMD


(u) RMD
aAA
8 (u) Pase Fee

() Lm b": bB

B
b
S bb8B
b
bba B

S bbaabB
B
S bb aabas
a bB
Sbbaab
S bbaa baba

(ö) RMb :
bb BB
S bbBas b

s bbB aba

B B Sbbasab a

a Sbb aababaa

b
b B

A b

a Yanse Tree)
Constructióg

let a Gramm ay,Gz


q2
eU uith
(VyyT

the
, s), the paxse

Londiten
devtahou dee

ane

Vasiable L VN
ah intesior node u labelcd
teminal o e.
E

a dest nade ü labelled by eithe Maviabte,


't children aue

f an intemal node u labelled ui th


A and
ten
labelled

X ü P

deruatienu but teu


Le can haue set
or one deivatiouw tuoe
tiee

LMb"C tet mat leviuatou)


One destate tee) ue haue one
moLt atie,thene wnll be
and desdv

Desv atew hee.


*AmBIquYY genertid by yammar
Am8iquny IN CFG L0) language

A tontist -Haee yammay danatad by G said to be anbijuous

t thene exit some sting. wtL(a)


wEL[C) that
that has atteast to distnet

LMD or RmD.

(onsider a Grammay, 3- sbs|a, ond a


we ab ab ab a

Sheus at Hhe

ab S s SbSbS
5 ab SbS S Sbs bS bS
g abab S S abS bSb s

ababab S

S abab aba
s abab ab a.

b
Consider a
Arammar OEE+E w- id+ d + id.

(8E id

E E +E EE+E
EtE+ E
E +E
id t E id+ E+ E

id t E
t id E id + id +E
id t id +id

Lu

E
+

E
+ id
2

(2+3) +9 ) (2+(3+9)
Renseu
nat
speration
not
) Becedene eporatene
E

+ E E

E + id

id id

((2r3) * 9)
lUnaniguu grannar

EET|T E T
T*F
F id
TF*F
F* f f
id id d

E
/
F
T
id

id id

id
S aB

B | aBB
bbba
)
aaabb a

LSD
a aBB
L aaa BBB

aaab BB
aau bb B a B

aaa bbaBB
taa bbabSB

abba bb BB
aaabbab B
b b
aaa bbabb S
aaabb bbbA a

aaabb a bbba
RSD
aB
aa BB
B
aaBbbA
b
aa B bba B
aaa BB bba
aaa B bbba
Qa bs bbba
aaabbA bbb a A
aaa bb a bbba
83 Contdex
frammar
bExp bEp and AND bexp

t we T ANDf OR
bExp

bExp
T
NOT
TFaue |bexp
fale

OR
bénp
bExp AND bexp OR bExp

T AND bExp r bExp


T AND F oR bEp

TAND P OR T
bExp ANb bExp
bEp T AND bexp
T AND bExp OR

T AND F OR bExp

T AND F OR T

bExp

AND
OR bExp

OR bexp
AND béxp
béxp

F F
((T AND F)OR T ) (ET AND (F ORT))
bExp bEp OR A|A
AA ANDFF
F NOT B|8
B Tue False.

B
B8
A

8#C]C
B

Breuedence
Asoc tiuity A B
3
2

8 EEE | F F-Fid
|FtE F

Preuedene
Assosdatuity
2
2.

to the gammas t and hae Same freedene.


Atusrdurig

i 'haung the

asoiative. EEF
(eyteusia)
(E F+E) Pjkt Reusuiow
- hab
has bath

ALot

A entst ee greratud by mang guemans


angg
2

to be theye a
Lù ad
s to be uanbigueuA
Li said

unambjgunusgranmar oeratig
it. 1 al the qrammaA

the value L ouTe


amhigug,
then Ld goaLd to

bo

He CFL aye -
L z

CFL
The
)
Elmin ting

The

8
vaiable
E-poductiau

ABC
A '
s
-

ullable

Nullatle
AEVaniables

B
A BCla
B bAC]& A

A
CCAB|E

Bc |a |c|
B

Cc S
AB

aSB a Ab

Ae |ab
S aSB| a Ab
net
aattb

teminatuy

S asb) ab.
Vaniable
Nullable

Aa AA) E
A
B.bBB
SAB|8 A|E
B bBB
|
L8 b

A AA| aA|a
3 AB
B
A aB| ab| a
A aB
B aa
A

B
s AbaC
A BC
Nullable

A
B b]E B E

S
A
Abac
BC |C|B
baC |Aba | ba

B b

Elininatig the Unit

A unit ppduuhn i the produrton & a keom A8 A

Can be
Thee pooductns be usehl siilo ating au
dunab unanbi qunus gramar. awuws, unt phoduchiovs tan

toMplkat corta pooks nd they also introduce

xia tep üto the dosvations taat hoed nat be thene.a


tekaicaly

To elintnate Uhit Poducions, we puocoed

CF 1 4 (u,T S),we tSnstut

i) find
(u (A|8), add Pall the
Ao for each unat

shoye
pan to

wit
pruduchonu

produchan un P.

Sa|B Unit Productoy

BA| bb SB|A
BA
A >aj be |8
p' SAal bb] a|be
8
A
bb |a|bc
0a|be | bb y

S asl ahl a
AB.
A B| ae bb

B ab| be

B ab|ba y

B a]b

:
3)

(i)
Elimunatirg

A sgnbal
the

eul
(keles

).
when
aducon,

t des a Aw
OS no tesminal

(ü) We say
Au eathable

but nat
wslich

onditimu
Renoued

Cac|B.
B
A BC
aB |
|b
aC
t

Poductens

Teminaa aye

duuùs temi nala

the UAvg he uaniables


productioi

UnKde S ,
then that uaniable iu added to set S2.

5 a (as A A nat ctat, t useles ).

5AB| AC

B
C
bbA
abCA| abb
||
aa B AB

b bD| aC

Bty-2

-3!
S AB

Aa|a Ab| bAa

ajb&,sy
A aA |BaC aaa

B bBb| a

SBaß
B b8b a

SAB
SCA
BBc |AB Sep

Ca B|b.
2
SCA a
A
NORMAL foRMS kor CFG

GHNF
CNF
Nosmal fo)
(Chcmiky Nomal fm) (Gveiback

e nocd to make the numbes

) We
We muat eliminto

elimnat
E- produehns
unit- produtiang
u)

i) We
must

must eini n wueles

fomal CNF
de

A CFG in CNE
NT T NT - Ne- emina
NT T- Teminal
NT NT

L
A Be

Aaß R a R a
X Ab
A bAB A Re B

Bb R a A
R2
R2B
a

A
Rgb
R3 AB
AR3 K2

Bb X

R3
AR

b
SABS
Baaba R AB R AB
YXaz BRy, R Rg Rz BRyRs
AXZ R2 a Ry
RsR3R2.
Ry R

YXR2 Z
R3
A XZ
Rs XR2
AXZ
a
2

CNF quiualent to (FG.


guen CF4.
fud the quammay
Rg SR3 Ry
SAB Ry A B
RIA
AAA ARA R3
B
Aa Ry Ry

RA
A
a

B bB B R2B A

R2 b R a

b
B
R
b
Bb.
Rerovt
Rermoual ok t ReuMAiO

A Bz

E ErTT
ETz E T2 |T
2 T+Z

2oS1SZ|E
GRIEBACH NORMAL FORM (QNF)
the

NT T

OR
NT aK KE (Vw aET
OR

S aB ab

Rename the varjabes


a :- S A

A A2

B Az
A|-a3 laxi

, b

aBD bDBc |
TA8 AD Remove let vecussiew

A aBbz|bD8Z | cz |aBb BD8e |

to the
Coutut a n GNF equivalort
gammar
SAA|
4 A

A A2

A Ap h2 a

A, AjA |b
Ahe

||
Aj
la

AAAs |aA A
b.

aA| b
Ag aAz| bz
bAz
z bzAzaAA,Ajz|
Z a Ajz Ay
S AB
A BS

AA A2
B A3

A hy h3

Ag A3 A, |b

-Ag

Ag >h3A Ag A | bA3A2|
B B
A2b
A x X Ay

A As

A AXS a As a A|bA3

VAg
Aya A3|

aAg Ay

bA2 Ay A2A2
Ay b A2

A3 A3 | bA2 Ay A3h3 Ag Ay Az Az

bA) Ay Ap A2 a)
Aj a Ag AyA3 A3 |bA)Ay A3A3 a AgAy Ag A2
)

a A2| bA3

You might also like