Professional Documents
Culture Documents
4.TOC Optimize
4.TOC Optimize
Reuter Language (OFA con be coostrucied ar mead 3 counters) @ © aijnzio > Requlan Lang wage (opA can be constructed) © wow oe Guby* Nok Regalos longuege Qorwcy nz = Not Regulaor Language OLOM eM] msi = Net Requlan barguoge Ep w bp © wre [wx € Giyt : Regt Language «w= tol X= loo wh tol RE= 1 @4d*t + O@HN*O @ wauk/ WE Grits ye Regul banguege (27°! canna go beyord Ss tergih) Inte 5 aw so X10 to ido obit ® Wy / <9 €Cot + ray a ay wW=100 » [Reqs Language] w 001 © PRED Grn 00 (+0 cor OF uy Gan © Kwa /x,00 €Con)? + INok Regular Language ® WRy/eayeConyt + Nok Regiskor Language = ber ch Ol and to ia Regulars. jogs having Guat our 3 ® sof an shiny 5 OCHO + I (ot? 1 +140 Scanned vita CamSeannerbce Ne Vewbices A Greenest ‘Taiquueraiy. supecanted by Cutie’ { le tn generally step iy , P= production, S- Aloat Apmbct Po sase vefsay Pe [S7988] go py | S3aB ry Ts fab Rab | Bob } [*: main tntention of the qromenn te to qe all the abinge thot | ome prerent tn the language 1 I pensation: Deriving the shing fron the gone using the stoskaymb! Sas Deivation of aabk S a8 ~ Sententiol farms ( Sequantal forms. G36 sS>ase =>aabB Left most dativation >aabB. saqabb CONSTRUCTION Of GRAMMARS ° OL= focab,habb} — SP aalal/La/ be (a4) -(o+b) A 4 SoAA Aralb © t- for/nai} -L- faraeaaa,aaca—"-} [e>ade] @o @ t= Coy” oo fear, abjta.ao, bs} 8 as[bs}e | Sanne vith CamSeamnetPack of al Aevings of Length akon 2} =me ch gt “Er = (ab) @4b)@+* A> afb B—> apleelé 2 f Length almost Ob: Steg messy S—An = @tbreKa+bte) Aa [ble ' A a | ©t> [alert oth O end ussth' bf = acts b @ b: fates ard end cath diff agmbols j = alath)*b + bath*a L=f zame ymeals} S> ata. [bab /a/ble A-7 adloAje S>aSb fab Ls Font naif Ot-fuuFy oarstfvsbut} [83 a8a/ bs b/a/ble , we Gt%)* Le feck oftan atiings ob even engh sane Sau iis Roan | * (areyoxe))* Aral , a 4 ' 2 arb" 2" fy, ms © ferns} ee ia A> atblab B= cB/c \ ro © Lefanem yn] mma! SaSb/enb] ' ‘ A+? cA ! 4 4Ss AB A> arhbfab Bsa fee (@e- forirer ge fam 2] i i } aa bebe @Oerforrer watt 9 aSbe fabe a ea'(te)” x For th yang we conret ge Auth roman Gwe give Ser for tis langucge ®u forrerme if § 2 aShb/a bh . sa soaSd And © & faremeran /nymai} js Baebes DL: fare end /nimat} > Not powible to give FG roa i 7 © Le fol EMM] nena} ®© Le faramyment | SeaSe/aac Aanrbjab = aia file \ Ufo em nna “far nmerch fei} —L-6 a Le CLASSIFICATION of GRAMHARS ——_———— according te chomnty the Grammars ce classified inlo 4 type ty Type 2 / Regulen Gramm mar a> Type a> Type” 4> Type © | Tec 2: ; TEL the Guatmvrcet bas Ql the parduetions of the form Lege Hreo™ Right Hoven Gramman Grane wai (Lee)fr Grornnats Abostd be ral LAR GRAMMAR CONVERSION OF FINITE AUTOMATA TO ajo The Trt alake Mhe Acomta % zame as the =O Slot slate In the Grammar RL Lzfarae,abpbab...} tant eotth’A’ de nae Lg Ls fa,barbata ---} por el thle Ending wih a! pa Bs pa —> RLG Bsiig ao -@ Ofer ‘Sead wh CanaanA—ab/ba/b B-rac/e C = adAlb6fa 1LS —7 FA CONVERSION = Types 2 Grammars / Context prec Gamma ~ CEL- pon tte 8s erg = pa S&S ro w ae) = G2) we jf the Grammar hak all the poeductions Of the for } j joo The Gramman ty the Grempk i called Content pace Grammar beoiose we pe ose A without ong Content (opdition) that Vemuat be preceded by a likewise. Type 2# Content price Graromays = = : frrbigions unambigiows| |Delerminishe] [Non Deteminianc! ‘ cre CRG , : | | | | } | | ’ Left Recursive Rit Recarvaive { I Gammoy Grammar Scanned witn GamScannet§—aSb / Ab [SSase S asblaabla S on \> Ease . By siti . No precectiies! Wate Gh g sae Mallade stakes + LA,2,3$ A—> addle =2]tohi u 25 che ENevet the stant atate fa nullable then the tong uoge Cont ons © and it must be present In the stark slalz produclicn. 3s Ab/B/a/e A aAafad/a > bea /eB/b © s-7 Abac Nuttane symbols: { 8c, a} | A> BC | GB Ble BOF Ababa /'ea/ aC | Cc Oe A Be /Ble Dd oD (Coo add epsilon eventhough &¢ an nuttable (-' Unced to add it ELIMINATION OF UNIT pRopuc TIONS [S407 bb/a [be © sarafa Step! @ B->bb/a/be A ‘ |b L A albe/pb. 4~ albc/e, JO 38 SK + S2B bb Ce - 2s—> KAP => A> KS bb & be q-sbe © S48 S—ae. Azo Aza Box 20 VE So B> bla | a : B2C/b core? CPO 1 Upetess regenbols | Csp Dea j 5. Not Reachable | DoE XK. E34 “fom slat share | - aed Exaiy ELIMINATION of USELESS SYMBOLS “ i Now, the orefal aymbols (ohich asl | ® ssadja Ts fare} qererele Zone Lermninals) archer, 5} A> Bjb ve fs,aitrc j => Be ie not useful aypnbols( G could not generale, any abtog from Bye i = Bed here ‘Al is not Reachable Ahexfove the | Ab D toini migeed Gramercy evil! be |s=e] | © 8 40m T=faybh csefulayntols Lore A} A a Ab/bha/a tau} NE 4s,a,8.c.0} | B>LbAfaB/ap, | C—> abca/a Db! San | [enna A Sahb |bAala . , °B bAfaB/an, | © S> Anc/eaB. T= fab} Osefl symbols -faib,B,A SI} | | Awaa /®7€ ean. ve pneie} 7 | B-> bBb/a C7 cAfac| K [> Not Reachatte > |S> BQ ea . B~ bBHawe ooo ee ODUCT ION. WA TRODUCTION [cHomsxy- Neem FORM] s [—Teentent poiee Garonne | ent Po}ec [——Teentent paiee Garonne | [ciety ret For] a cNF: au Tf all the Productions ase of the form [A=>2c] of 47S whore AB axe Variables and a’ in a lemminal- Advantages : Length of cach prroduchon ia Restricted 2 Poivation Leice (om) peste Luce ohlained fiem CNp & alengt Binary tree 3> The noo} Ateps Mequiced w derive o ating of [length tua] ** [ead] 4> Tes easy to apply cyt membership Akgorithe Q(03) Kene, z Jing toto CNF2 ® convert the following 9 gn a/ne 7a SoA Ae tel {No 7 ya eee Ne A 1 GO/ 65 be a s 8 aPe/pS/b B= N,@e/N, 8/6 Na Ne Ny So NA/NB A Wr /mS/a B > nap /nS/b Scanned witn CamScanner% ALQoRITHN (MEMBERSHIP ALGORITHM) © 98%.) Deheck Ushether the string “baaba" te a valid member ofthe Pras, loonteat fee Gramman? | S-> abl/ee | A> Béla B—> cclb Cc 4Bla * The C¥K Algoatthm tm usct te check the eg et | language generated by the Gramma or et. => [Te cyk Algorithm can be applicale for only Cnr Ben | | Garay, Giver Grommay = S—> AB/ac | “A> BAIA Given sting | Be> celb PETS j CAB) | 7 a ; ee ee ee | 5| Ac | Cell mo C103 : Now +the G1) siepriesent the Vent . fe SERRE Neotiatle “by | Th the yeqyuired Str | [4 tor) "4 | SB” 70 dhe value of cen G3 | Seannac witn CamScaneri a (Blast usth 2” and = Nalue of (2/2) th the given abiog t ia @ (2 bee) oa outset & now see which vasiable cenives a’ < {ae} cen (318): The Alphabe to the (33) ta SO faye} vot generate a fac} st :@a) cen @) Gell 0 (96) GA = b> Generated bg 'B’ Gsis)= = fae beat reo ™ «2)3 45 . Gin 02): |bdaba ‘ (2) means tant with 2) and end with ‘2 -> “bat GO = GD Ga) ia Pe Gerla ci =fbpcfach = faa Be} = fa, s} VC Gengeaded by St ne Giz): (232) = (2) x (339 TR. Jac} x fac} ws fgarag carec} = 4B} “Gre dertvediy any of the agmbols: Sell mo (24) + G5) (44) xs) 3) x (4a) = fac} x{a} = 4 BR x fact mal ewe bt {Aw cep me =.4 BA, Bc} se\x! aad = 4a, s} fast Scanned witn GamScanner(id = a] @ 3) te 0) (rsahse = 123) 45 a3) = (003) EY DG) " efatxtap: — {as}x{ach = {oa} : + haa, ac,sasc} = fot e{x «x x}eSg} (a4): (22)*%@4) @n (@3)xCaa) i = Asprisch Go {B}x (oh j = {aa} = {as,ac, 88S} . a {et Similealy continue for vernal ning cel = fot Now, Gis)= baa ba Gz Baab as)=(00 (2 5) -fas} (la) = (2) (2 s)efsch. @) (5)* fa} (4) (55)° {gt : + {s,Ac} Gis)= 2 3 45 (u) @ 4) = B8x @® (3 4) = AS, AaSS SC X OD 44) =f} = ( @2) (35). pace = f5.c} @e)- | (2) G5)> pres - day (24) (45)= Ba, pe =fas} TD) abe cell Clast cent) (16) Contains the atcoiting aymbsl “S) we aan gerne dhe Sting fron the given Gromman Now, whal one the Vootious sub abvings thas can bk -generated fron the Gearemoot é Of the given absing Wow Check Whee the ateonting agmbole @le prerent in the table ie tt * present at celle (2) (374) (4S) (215) (5) + 4 a Given shing boa be {hay fob} {bay fata} ~ fea araata i 4poge enc! LORIE Poea(ane? 4g oe aN the preduc tons Cf The Grammas oste of the fem azar uobete. | govt then tS called) GNF - DE eye Am aBbe ATO adantages, b Te Toro} Ateps stequbied tp generate a Atving OF length bo) 1 hel iy ANE & Useful inorder to Convent a CPG te" push dow fudomata! CONVERSION OF CEG To ppp: 0 Ruth the stant mapa ee cole see SGue 2 GA) > push Ris ob 4’ as Plows [EGrat= Gd] ij baz *2 nec 3> Add Fal state with SG, 1b) A= Gy, 1 PD] y [A>bp is To Gramm SANE, %)= Gy €) © S- aSb/ab —> Not in GNF Ie GN (biB/e) tlt 5 Gas/e) (aS/SB) 6) 62 (82) * 701%, © )PUSH DOWN AUTOMATA L468 Push Down Automata finite Automata + Stods R Yeh Pour aedormta : (@, 5,6 Ay) Z0/F 1) Se pinite set of atoter Zo= Boltorn o}, the Stack E> dopul agente! F = set of final totes S= Transition function PP? Stack Alphabet oz Initicl Atate [eater mint por}_ts= axizvcfer > exn* | : [Poa j j INon- Deterministic POAL |¢ - See i L= fare /nzi} ! Leb the ating be aabb (a,a/aa) TAIN & a" (bale) Acceptance at 8) cep ter . Sate eee) e242. $y29,%)= Cyy/02,) pon by Empty siace 8 10) = (@,aa) | | S@orbsa) = (,€) SC rb+b) = (ay,€) 8% % )= GD mED) =e) Acceptance by slate “Acceptance bay Emly See otAcceptance by stale oe , PDA s\ Acceptance by Empty slack @ Ww EG) /-7(4) = 9,603) Let the avig be abbbaa @ fe) paras ‘qub/e) (6.2, fro) et U va Zo @asoc) 2 J (bib/be) "> push als onlo the Stack » db Yoo bee b pop ome a! & vice vere. | 3 dy our Alphabet ie! G “Bolton ‘eb Soest ee btu Stack, © bs [arb e fame 8 i | ames) ee (ci%m/26) (6) 2/0 te) oak) © Y Sis Led @ bs for uP frm} @, sofa) ga (ciavé gary’) & es od laos) Ou: fomtn EP fone Canis ) gee gg bn bes (bave) Ones en{> L: ho BO fom si} t : 2. Grzola%) (ba) Ghe) Q (a © & (EAL) | (aajea) (bre0/%) | (6, b/ bb) ‘Ou fan one [nm>!} (aja/oa) (elas) ae D 5 bang (baja) Gare) (brb/ bb), ® Le farb™e I” foun s 1} > context pree languages | ib fan bm em™gn Jone!) i | pcs '@-- fon EM EMA] mim oth > Not cee \© Le fan 6 (ma i} | The arg vage acceptect 18 Ls fabb, Aabbbb,caabbbbbb- a => The aolution bo Constwct ppa-for the above languege is instead Sf pushing om a on tothe Black we push kodak aml pop them ogpinst ‘B's which means Wb Fee a al, tusill push 208 Onto 4he Stade (a,0/oaa.) Q@aloa7) Gao , . Li 6) (bale) @) (€,0lz,)a ¥ & The other Adlution for the above problem 18 for every two Us ux 1 Fhould pop Aol. which mecink we push all the ols and for putting "b’ On > the stack we pop ta! agains the cceavence of 2bs . © (aafaa) (a.2ola2.) Oi foreren/nait => Not Reg FL @ ve fweew* /wwe Gay? } (ada) bJode) 5 ‘) Gala) & Gol) @,blb) wr @) (b76[b2) @a/aa) @b/ob) (bea (ta) ' (bb/b) Le fow® we acy} gs io I No"ppoA” for “Hie. Language wehave -to constavet’ NPA (b,Zo/b2) Cbvb/e) i (@,7ola%) (aa. (a @ak) a oO (ble) €,70]%) @b/ab) (ba jab) . (aajaa) Non- débermniniinn: , NDPDA isnot as powaf! az pppA