Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Unit 2 OATE

PAGE

Context Free Langvage


Tn tomal
lang. hcor, a Context celanguae is
languag Jencated b Some Contt Fee Gamov
The set ot all CFL IS
idenhtal to the set ot lnguais
Qcepted 6 Yushdown Automata
t s deincd ttuples 6,i,SP
Set ot varaLles
non- ttcminal
SCFof teminsl SqmGols- Sqmbols
S Start Sym bol
Ptoduchion Rule
E For encahins a languege that ncrates equal_num
of as Is in he fom a , thc (ontext Frec
Ans will be deined S

G (s,a), e,s). (saGAL,A AU|E)


S a Ab
a aAbL
aq6 (A )
DATE
PAGE

Veivahin ee
A derivahiom tree is an_odekcd (oted tree that
raphtally CpresentsS the Semanhc infrmehidn
Sking daived kom q Contut Fre 6fammar:
E: F the ramma 6-V,TPs3
wh S 08 AE8-0A
A2 1AA E,B-OAA

CB

A
DATE
PAGE

lett erivahnTeeightDerivehon 1ee


St o6tained by appling
is &is ostined 61 0pling
toduchion to rhe lektmos foduchon to the rizhfmast
Varile in e«ch St Vatiable in euch Step

E:forqcncahn fhe Skinj 2« Sq


om 6rammer3- aASas| A2 SLA |Lal

(S (aabay) (aaLa

Always choosing the lCEt Alwaqs choosing the right


temcatoE thc pait elcment of the pait

Ambisuous Orammer
amona ts Sad to be AmbiguJaus it thee Cxss
tuu o Moe deiation tice fo a Sting w
hat means tuo o Moce let_deivahn tiecs)
OATE
PAGE

Shte l Consists
s atht,*
STs Tab7he Sking ar
Con Aencat aS

SStS S-S*kS
atS StSS
a t S*S a t S*S
a t a*s
at qkb a t at b

.:This ramme s AmbifuousS

implificahon of (FG
Keduchn o CFG
CE6_Somchimes all the Pladu hon roles &Symbols
Qnot nced for the deivehon Stíings Besicla
his they may also be Some Nu _oduchons 2
ONCT PoduthioHs
Eliminahm of hcse_lloductions Symbols Called_
Sicmplihtahm of CFG
DATE
PAGF

Simplicahon Consisls of the Eotl steps


0 Rcduchm of CFG
)Rcduchm f UNIT Pioduthns
Kemava of Nul ploduchons

By (CmNin usclcas SHmols


op to itduce ammal

Each on-teiminal 2termint|o G peais


gppeas in he
th
daivahion oE Som urd in L (eng
2 1hcC Should Apt any Ploduchion S Xy whue

( E(cpsilon is nok în L(lang) then thee nced


not e the_pcoduch'on XE

KedueOrammar
KCmoval
Usdc&s Symbsls
Elminartom Unik produchon
oetoduthion
DATE
PAGE

KCmovq of UsclCas Smbols


SHm&ol (anle vscless it it dos not eper on

the riht hond side of _produchion it do


not tale_part in the. deivahin o any Skipq
That Sym6ol is useles

T ag8 abt aaT


A aA

Kete "C is useless hecause ik néue{ otulS in


deriuation shing.
A is also Usdtas becquse heee s no uR td
terminete it
Keduced Gamma

T a8 QgT
8
Eliminah of E(cesilon roduchin :
The ptoduthions of tape S-> ac called ¬plod.
hectpe ot ploduthon can onlye removed iom
hos R4mmars that do nok gencaale E
DATE

PAGE

S XIX
X Ox

we nced to eliminate

e qic achall plecing at nht hand side


wheewer *LV appeqr
S X YX
i5 x XY XX |x|y-0
Fr XOxe
cplacing at RHSfocX X0
X 0xO -
Sinilarlg -
Redued Grcmma
SXYx
X Oxo
x |x|Y
Ix|
e
DATE

PAGE

Kemoving UnitRoduchom
0nc non-
These are the Poduchonsin which
anothe non-fumina|L
tmina2iveS

S OA 18
A 0S O0
8
C2 0
BA
Onit prodochon i S C

nsteadot put Co
S0o 0

Similedly 8- OS 06
Keduced Gamma41

A
8 05 oo|
C01

You might also like