Professional Documents
Culture Documents
Assignment2 CD PDF
Assignment2 CD PDF
Assignment2 CD PDF
Strin9
is T
paYse tree (
inite set of variable
where V, a
a E V UT)* S iS
Called
Example Let us consider the 1olloLirg
a mna
A AtAAKAa
L e t us considey a string W geneYate d by
the q ra mmnar
W = ata x oa
sting)
A AtA A A x A
7atA AtAxA
h ax a atAxA
a t AxA a t a xA
i
t a xA
ata xa
ata x
Wecan see +hat there exi_t more t h a n
one lettmo_tderivation forthee Strin.
He nce we can say t h t the 9ramm i
a m biguous.
e + u_ c om sider a: strin,
at a x a
W
Now, Lets see the right most deTivatim_
Y
A A +A A AxA
AtAxA Axa
At A xa
Atax 1 Ata xq
) a t ax q at a x
Sting
nce, E ambiguous 9rammar
L e t us cm sider a striny W
W=at a xa,
Lets dYaw Paise tree for the giver
Stin9
X A
7 a t a xaA
A
A
at axq
CA A
ree exit
AS we c a n See fWD paYSe
for the givenStrin
hence, the gYa mmar mbiguOuS
Let strinq W
gain uS Cmsider q
W =ataxq
dras Sy ntax tree fo +he
NoW, te tS
given String
ee TYee R
ee alyo we Can See tuo trees
exist fox
Syntax
the qivem strin9
hence we Can Say +hat qra mma i
ambiguou
ierentiate
Tee
arse thee ond Sxntay
Topie farse
Tree
Synt
Tree
DefinatioeADasse
an
tree I A syntax istree
oxdeved, 8osfed| a tree Te prese nt-
tree that xepse -
atim of h e ab-
Sents the syntac-Stact syntacti
hc sfvucture sF StYuctuYe ot
source
q string ac¢oding|code written i n
to Some comtexE |a p o9rammng
Free qramma anguaqe
a der vati on
ferminal Operand.
deri-
the Syn_tax of a
resents the PYO9ram m i n g lan-
v a t i o n ot the
obtai9uaga asa hiera-
Jva mm ay to rchica l tie e Sim:le
1nput stYings Structure
E
£xompe
for
String )
W= id tid
Xid
9 rGmmar id E
id id
id
Comsky. Hierdvchy
Chom.sky Hierarchy represents tha closs
of
O anguage_ that re accepte d by the
a
erent machine .
fhe types ot lGnguage
Ch.omskys Hiercchy i&
p e O knourn as Unnsestricted C2ra mmay
pe0- C2ammay
pe Context sens
e r a mmaY
RequlaY
YaYnimar
Where *
i( VtT)* v (vt T)
V =Vayiable
TTeY minals
*
Bi (v+ T)
atleast one
In type o there m u s t be
on LeFE si de ot p roduction
vaviable
Example
Aa ag
S A
heve, vaviabl es
are
S, A ,
are a, b
Terminal_
ype aammar
6 0 CSC
kngwn as Comtest
1S
- l qra mmmax
I y pSee n sitive m C2rammav
Sensifive qrammar
iS sed
s ed
The con tex t
sensitive (nguage.
to yepYesents conte xt
nerated by +he
T h e lanq uage ge
arerec OYnised by lihe ar
gYamnmar
BGund Automata
pe e
2 aammaY CFG
2 Cs ammar iskrumuas Comfert
pe Tree lang-
free Caammay e m t e x t b
uage_ hch can be repreSented
Context Tree 2sammay.
The lanq uage qenevated, by. the qram-
2a S recognied, by Pushdown
qutomat a i
WPe 3 q r a m m a s i
CnsammaY
language_ a r e thOSe lang uag
Requlay YegulaRr
which Can be described using
ex pre sSi on s
are ex actly call ang uag
h e s e langage_ finite S t a t c
+hat can be aCcepted by a
qutmmainn
can be modelled by
Jhese lang u g e
NFA Or DPAL.
formr o
the most restricted
ype3 i
rammar
ype L
S ab