Download as pdf
Download as pdf
You are on page 1of 22
“ ” TUESDAY ‘CONTEXT FREE GRAMMAR. A Grammar Gi eonferd ree Hf every production tx of the + A ob. where. AE Vx Gnd oe (wuTy* Ex: Conshuet —@_contexd a ar G generating abl intege Tn: So) Gels. PS) Yn= { §, (610) , (oreiT) , (NTE UFR Le {0,1 2,3,4,5, 6, 1,8,54,4 Prorists af S—> Csign> Cimeger> éigny > 41- inher > C aig oihals- DERIVATION. TREES $=. The derivations fy Q cre can be represented using res: sucky Areeg representing. devivatton _ane_ealled derivation “trees. “ derivation tree [alw eae parse thee) for a= cry Ga (Wa PS) 4 Every vertex has a_Jabel which isa variable or terminal orn ‘5 The ook has label § if b> The_Jevel of an internal “vertex _i4.g A Sha |ss} ba Ahow that _s ==> 0d bbaa 05 == oven Thee! are Twoi Tybee derivation (1) MEET MOST DERIVATION S— A devivodion A» w ix alled a Je} most derived ion if we a Go production only do the ie most variable ai “every step. —)_RiWHT MOST DERIVATION: A_devivation A==yto is Q «&_ tightmost -desivation if weap production to dhp wight most voria bd at every step “Ex:- het G be tht spammer seiveeS —> OB] 1A A—> 0 [os|taa B—> 4] 15|088 fev tu_shaing_ oo 11010} Bal ="@) The Jeft most “devivabion &) The Righimast derivation = © The desivation Thite, Sol() She Jé}tmost derivation, S—>0B = 70088 [8 = 0887 => 001 B Ck 19 => 00108 [ B—18e88) => TCR Pe = 001o (Bes [a => 00110108 teens = Ootsotol. (sai (2) The Rightmost devivation S08 = 0088 [eon => 0061S Ces 1s) => 00808 tg> 0 =? 0OBl0tS Cass > OOf 10 foR Fh OR 08 aay owns =) OOBLOIOL => doftotor [BY = 00 AMBIGUITY IN CE GS: A shingwis —ambiquous If hue exist {wo ot moe devived ion. Asees fox sting WT defd mont derivation) u N example’ G= ({9}, ea f Whne pi S—> S+s]sasfalb corutiuct derivation Aree dow stain “O40 ¥b” © S => 84S ats (sa) =F Q+ SHS. Ce > ed =p A+ans [s>aI =) Q+ ab (2-> b) Q) => 9 #S => See yc (SFOS) => OpCHS (53 Qe > OAKS co pad J A+O%eb C365 soot{otot ed | me i EE 1 Cp is the Grammayogerscisja Ahow that—t—is mbiguieus ar go ‘Oh Tg prove that Gis ambiguous we have to find Aw @ 1s) whi tk @mbiguew, - conaider w= q@hababd HH we tt tuo dexivation o dhe ig ambfgua tree “for Shs abs =» AbSbs [S10 => Ababs (s—> 4) =A babtot Cho) => abababaiira = abanabar(s @—s3—>.0-vt > Lbs bs_—_ [sos SVanres fis ay => @babst _Cs3-) = aha bey Tepes) =) 4b 6 babe Tian | may, “MONDAY "16 eliminate := S ‘tC dots not -cevive Gnu Joxminad sing i[variables nat deziving +e ing) _¢tri 2 E and cole not abbear fn any gentia) form o[ Symbod not appeaaing inary derdenaiofh) Bi E—s a) 18 a null froduthon’ g 3{-nuli—_producHon} As BC Zimply rep faun BC 4[ produghisn af Tha form A-->B 3 15 quate pect ere “A Qariaece yor DERIVING TERMINAL - STRING Sa yt SC Tf G fp G CEG such dhak L1G) + we ean fino an equivedtent: com Auch that each ‘varia is G derives 4omu_ terminal hatin o. ‘ { Sheth Ge tun EP) we —definl {3 G = (vrs, pis) ab follbig @: CONSTRUCTION..QF YH $— bu) = {AE Yu] There exist a... production Au, WES3F Sie SWS tAew| Ax I Leteunny hen Wk = Wk ae pe_ Wie 1G CY" tonetenctioN OF p's vim p= fA UA, LE (wiusy*} Now RAmmar 18 (Val, 5,p!.s), Ex: G2 (Vans, P, $) Pi S—>AB, A> 4, B->b, BS—>C, f—> 6. Finn yy f Auch that Sveay Variable in devives 4ome terminal aeg (os Q) ConsyRuct fi = 2 ConepRuction of vil | Wy = fA, BE3 Aine ASK E— o@ tal Wh = Wy U fA, evn] A> ae (xu wary = {A BESU LS} = TA, 6, Bot T= Wig skh; U (A A> C(EULSA.ee) hig =b U > hls= heh, =o Thevefove Y= {S,A.6, £3. (b) ConsTRUCTION OF pt papa sefA ce (wiuz] = {SAB, At Ab, Ene Theve 40¥ = ({5,A,8, E}, fa,b.3 PPS he TE yew kemes | 18 Ty BRIMINATE THe _symgoL., NOB ete SENTETYAL FORM T= G=(WnE, PS) we construed an | equivaterc grammay = (vets! pg) auch_that~ every aymbot th vau's® vthbear fn dont sententiay form! 3 q (© CONSTRUCTION OF Wi!- ob = fs} By wer = Wi UEX Eve | A> 4 AGW, %tondatning Akt Aymbol XT. byw Sw} (BY ConsTRocnen OF Va 3% Pt Eg Va = Va Ab = aeRT ST PhWK . 1 0 == oy ph [AA Chie} “wom | (BY CONSTRUCTION OF My’, Ph. & Concider = (18.4,8.E3,$a.60, WE {SA B3 7) Bz fa, v} _ PL Sp AB AG, Bb ES pt ={S—A8; A> 4 bof Sol" coneTRUCTION OF jt ; = D Gaammag G'= (yt PLS) w= £83 . ‘Note: “To abtaintal Redute bh = bd UE AS A00, ea ; ‘ Grammar toe Ab thuvresy = faju 94,8} 7 63 Fiat thn” Thom 6a, “We = 3S, A, By TOU Use blow 3 Akin “Yy—= bv fa) 6} ust nok” Gat Recliy Gramna)S Ws = 2,418, Tbe shia s & wy | gemma G whose ‘broduchon S—> ABCA , "C— > ab]b- os disse Ae Theoyem 6-334 a Ney A,C bh = kU 8} te SCA q B—> BC/AB, A> A—4@,,C>b “Mh = {Aeyu fs Ww, = {4.0 . Ws ehh 0g Shh SMS be LS ACF, Ps [SCA Aa, Ob} A allay RE(WOSP 23 WEDNESDAY Thus. 4, = (US-ACy, 4a. bY, (65e Aas $s}: Gleb2: Nous Opbby Theorem 6:4 hi = {8} i bh-eld 0 $Arc} = {s}U Sac fg be ={S, 4,0} Wg = hi f ab} Mis = £$,4,6, 4, bP. | Kd = Ms MW = My Nts, Mal = {Sach 0 $546.0, 63 va = {S,A\¢} Toe Ta ws = {a,b}, = {SCA Cb, Asah Prt eto} —$ y uy 2 a JEVAMINATION OF Nu. PRODUCTION :— Theve ove : If G='[Miz,p.s) is a cey Shen we, dG (fic } eH SAPS can tind a, ce G having. yo, Tul a , production 4 = Ex Constuct Reduu Grammar equiva tothe grammar = (@ Construction of / »S— sada, A—>Sb feCc [Dany Skepl “w= fA ew] A> a3 if C— abb [pd , EC, DADA Wy = bh UL AE Wy AS EU rer) Aaa Sled a pata (Sach, a ay ey a kay = ble slepar Coruhuction of pl | Dany prodution wohose RH does not have “1 nullable variable ist Mheluded in | (2): The rain ant oblained by exasing 0% nob ek £ome_ 07 al nullable” variable son Rai moro ¢h = Eve PS “<< may Gye Goneider the grammar ~ praductions ave ssas|aa, Aon, constiuct Gramma BA, Db G without nut production. Sof Sheptt lily = Mh Uf = ble. ) bly = 1 8,4; 8} Step 2t Qonstmuetion of p's : Db , $05, $=5a sein? GQ AB = ($5403, 40,63, PS), hie LA,B}, ASA, 69 hive{a,Btuds}, san ABEW Seek 17) 4 of may MONDAY JATION GF UNIT PROD ee ON ‘TE Y ig Cey , we ean ind a CF G which hax no. unit production] [a — 8h Sb Construction o} the “tet pa derivable from A Wola) = {A} hatin, = bj (A) UL BEW [C8 ifce Wirt elegy = Me => WOE Mela) sieb2:— Conyhuction of 4- rial in Gs, 6 non unit Production ¢' @ AS a Be ew Fu(c = Se, De 30 O(D) sf DE] we) = {EF @-dlep SAB AG, E> B— ba, C34, 0-4 i Bywelaet | Cy be S> AB, Ae au 7 CoD, DOE, Ea. ‘Eliminate unit produgh on sf Outs) = {8} beh (8) = bos) 0G = MoS) wr (sy-= {8}. uta) = fA} > mers {8} ates SRO LCT = {3, cy hh (0) = {HeTUIOT=L 8,0.,03 » ase = 152, 0} fey {00,6 } tait8)_= (6,6, BEF, Mole) = 4c} CC) = fof U{ IJ -=fC, 0} eto eb}-ut ey 6 JUNE **Reshicling tee a “ste on RWS fx Reduee the following — grammar G to tNF. Gis 01 JUNE owisian NORMAL FORMS FOR CEG! kihen the production in_G sabisay certain veshictions, then in nite be na“ normal found There ane two +yhes - = * = b Of NORMAL FORM — q aa t | Da ae CHOMSKY NORMAL FORM (CHE) at GRETBACH NORMAL Form CONF) "shy There n0_ null production cheba and_unit production bbe pd * S—> GAD) => 'S> CaAD Ohd CG AS OB =F AS OB Ghd Ga + bAB > A—> GAB ahd Gob Ie fp [eb Dd, > GAD See . CGO, AA CoB Ca —FR A> GAB) Gb} xe a CHOMSKY NORMAL FORM {£NF) ‘= AateGsG is In Ne i eyeny production is of the torr" sA—>0, A—SBC Qnd S—>A_ jh in—G-S 1% not onRHS~ CONSTRUCTION OF GRAMMAR IN_CNES Yate Climinition of null _froduetio and nit productions Sea. Elimination —o} Acrrminal on & 4 == A= Caf 7 Bb Ide | ae | Gb S— Ca Ad => S— Cac, Gnd 6,9 AB f A G,AB=> A> CG and GAB A oi Wp faces, B->b, Dd a> A, Co by S— Caby CHAD A> CaCl aBt G = ({EMi6,0,6a,0nj0,,0}, fh? l RS) JUNE TUESDAY 2" Tiida Nf CN jal to. $=+ OAbB, A—>GA]a, B08) | JuNe WEDNESDAY we GREIBACH NORMAL FO Aecey tS in Greihach Normal om ip every, production is of he foam Av ak. where QET, Lea Sn bat Six noting om (7 A Ady | Adte|—-- Aas] P| Po Jet Z_be @ new variable. Then 9, definid a1 follows - @_A=production in. P, are A= Bil ps += A> pz |p lesz @ Z- production inf, ave 2 o|xeleda\e--- “Gyr SF GABA, A—>bC. Bob. “in _in GNF Lemma @1:- emma 64 fh useful Fo elimina A_4rom the Rts of A Ae OF A BY ft t +o—ehiminate— fit variavly on RG - A=pGab, A> GAL s6) 40) & A—sanab} pBeb]-aaab 08 —_— UNE ait dbs tht grammey SSAA | Sieht: The grammar _{a_Th crs Rename the variable S = A, a> Ssfb Beale = A> AAA = CophugHon of ONE 4 Wola “bee -censhruc CNE: And Renaine dhe = fable. . 7 Hebe" Te eget the productions fh >the form Aj Oy OY Ap 9A et 98 Convert Ay—predugtion cto hy form An—> OA pon 62. medify tt py An—> Ar’ i te Modify Are producti skh Modify i= ae —+ 7 t Bo A-S-04, | Ar 3b Aran ZA bl cle A, > AALS Aa Pa aaib i A Ao A Ay Pbbly Jotama 1 ‘A AA, sa, > oat he kemmé 6% To. Aazfa: ne —_ | BY ha ana wune | MONDAY Z, — > AA, ayes A] b2Ah Rr WAZ A> GA, b]aAZ>] bE zo tp nwo rlamiable [Ae- praduakor} Zi > GA] BAY OA ZA] b> Ay 5 0 Za lab Aa= pioductions cnt Zo OAyhiza] ba] anesaya|i f= > ans} anz| = (faomrt 107 44) GAy—fraduaHionl ae AFAR, Convert the tramnmarr Aaa apply frmma 6 L- S348, A— 8S [b, B—>SAa ine & ; + eam i = A alann |bmfanzaafoaa = a (| Stepli— The Cramman it in ene pe on 4 a Sips 2 prone oh 3 Rename the variable = Ay SEA, 2 MAA app tin ad g eS dle Kemma 64 = 5H = A Ai |b? a . Za=sa mi BA HDA | AA a D> Ayia | PATIO AZ AZaf BK By, —> Aika 2 Ae Boas mar 14 aera Se is bash Zs[ BRA [a25/0 Za A Asan = Za AiAsAZ3 = Hebe: Sth Aommg 6400 ALA prduetfons A yA As > Al AA as [BAS Ai Ashi A> DATA As | basda Aids [az AAs (AAAS sy AF DAsArAZA As] bhsAa My Ac |azAde As > AshiAsAa| basa | O. | sz Apply lemma 6-2 me | AaJA\A3Ao]/bAzA2[Q a a A fdeh| _ a [amir | bas = “As Bhs Pof a > Bho Aa bh heZs A] Pa bh A.B |OBs pe bhabar|arsh|adife D> Aish. 9 stb ag—> Arse See P27 bAshrAoAyAsdshr. Za—> Arad 5 = ag zs 16 D Tf Le ond La ore. conten free Jay quoges then 12 LVL ma algo contend free eee Js, The CFL tt clozecl alse i a) HPL, ond Ly gre hot fontent : © Tanguatye then Let hys ahh Ream 4 i alro Seong. grt ts Tho i4 CFL ty Goscal caryeatenattony 9) Op Ly aka ha conte rte mee Lage — dla b= sar be alto “eontoa frte_Laptigg : that oe CEL 14 Clggco! a Onetyy —edeery cloares ume 19 RITE AUTOMATA _TOCFG.— T 0,6 A—> 08 B—— a8] 68|4 t on i Y— 19, [0% Y,—> 14] 0% Yas} 45} 4 C= Peas torte f aoe then Le Lyla “ at be. tel That fq CFL wa clogesl undey inter 2ecdon, Se 9p Ly iQ CFL hey Li er men mel he ORL Thats mons CFL Sh no clogéial neon ae | p 1) = REGULAR GRAMMAR HO FA A— > 0B|bAlb B—> aC] bb C— > GAT bc] a q b b b 6) Q— S08 [tafe — A—> oA ftAfoly 6

You might also like