0% found this document useful (0 votes)
26 views

FLAT (3rd Unit)

Uploaded by

S. Rishikesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
26 views

FLAT (3rd Unit)

Uploaded by

S. Rishikesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 87
7 r . ee \ Nike Uonuages lowe a natied ntorfve velaion cated” od -ree grammars (CFI) sraser agplcadion of cFin by tm prngienming Sngtagt and Gomi design EX Some of He Conturk free Gweprnges are Q Lek are” [ne1} eee it) ) Lefary” [23 ) Bees. os Me sting = no eb Ns m sting } ; felis. a arene” fay 21 my t <1 argc? [rim 21} bef arargr ch [am ri spy Join ea | sheogs hich ove all palindro eS over ies} , ee ae i hae = whe de (vot) Z the ght ord cide of Chen “A et vesthcted ard Yt moy be rull t04) o Comiration Ob Nawlalles and deminals + The prssible lent ef right: Wand Senfentiol for carges vm 0 co co Co &|al £e0) a) $ Jasalastle a) Sole A IS 3) SAA Calal[b re be Gabyaabhsaabl;- =: ? asblab oblatin CEtg fox the Srqenge = t »| Nalw) = nyt) | cen: L«f e ab ;ba., abab , vaba abba j baab, --- ~¥ mos" s-yssle. $ > asb[bSa 3) Consfuct Chi for the Languoge L which Cas att the whic are all palindromes Ove {aybh iL =f éa,byaa, aba baby abba, dleaba,:>-_§ eS oat : 5) Cornel ch ty tHe Inet Legend" [nzey Site pe fe, abbpacthdh;-- 5 J ae? asbole é) Consfuct a CEU or de tovarrone L= fats" [nro golehion= fins 1 & ab, abab aAbabab, . + ey $4 asble 7 Construct 4 Cir tor the ae Lef wt / wefany J Sebo bef €panjhb, abba, baab,-----_} 5-7 aSalbsble aj es a. CF ov he Gnquage L 5 ase” [0 24 L=f abe, aBhaabhe, abee, abecec, “_ SAB A > anblab b> ebfe te) Corsbict 9 choy ov tH begs)’ lee S ae frum 214 al Sy ast/aab i A= elle 7 =o a> ant lab n> pre[be 3) Construct ao cry for the Language L- i ae [rum Solution’ fc { awe [oun>' \ SAG A > afblab B> be] be . ase ane rf A > anvjab : ae Le farrc™| mym2tj . Solution be § arse [nro > J ety ase[ane A > bAe | be 16) Gonshacl a cen for te Hapa t-faw mo Y 5 —eAlhc A > anole Bo abla c > belb foethuct a chy for tH eee ; 4p. we t devivation ‘A duivation ‘8 Said gn the Rene Fo Oh MP the Mftmost veriable Keenkahee deve Satistying cfu: tach resented tty a production of uy B “ep the foto wing Condition 3” i) a AD 41 4943--4n a prduchion a beto mes dhe fravert of rede Jabeled 1144/45 49 tatection of eldten fem teh to vi gt a yard ~ - A] pmo A me hn vor . ee am tabeled vith € or) hvminod symbol - TF cro ) $ ss /ast|osa[e ; | Find the a!) Lefimost derivation | 2) Rigidraast dinivation 3) Orkvedton ee | Y the sting (w) = ababab - 7 Solution! - tavern sting tw) = ababab - Lelrwst deivatl: gs gg D>asbs > abSabS carente4 > abaSbabS 2a 2 abaebabs 2) ababah $ 7 J abababe 7" 4 ababab il daxvvaton: Adres) = atabab aed, - sie 2) Sabsab Sabasbab Sertentta) Sabaebab _ Sentestiod ores'- Pony sting of, Variables ard|ov formtnedd “dasived) form the stest symbo| 4 aathd a Sertenftod form , Se et Do gaat Sentential orm, ES ttt ~) Eald a t4id + forme, . " an sight alerivotions for the Tt adn be a = aaabbabbba s Shing (wo) = aaobbabbha = aabe => aakbs => 4aBbbA 2 aabbba — D aaapbbba r , oie wrap oot devivation for the sea and alto draw tne deefuction fee - g — als > asbAas 2 aabAas > aabbas for the sting Bae rnxt and right most enivertion st derivation > hinges) = © O\lor0 | Seas S068 = 0088 => 0018 = oolls 2 601108 Doeiois =) o01\0)0B > oollolo | = 0(lo\o] ( of Aree : Pee seis = oolnl = ooos] ’ SoorsolA] =) o01lolo | pee ee 3 Ys Ai is, «| ‘A © Shing Ce9) = Pl "3 eens > ibt S EP Etlerse S ~) fLtibt Ses 5) qbatetaeS =) bt ithaca Peres | wet fctaeer . a btae a Sitcl ; F Pe TOES bE ove « i . : ring we Ll) for cohich thee” re distinct tetmo deivetions,, of dure ave tue (op E derivations ,o7 thee ave two tox) move distinet devivetion crees + JD show that the following grammars Gs amb fquoud with wspect to the SHing aaabbabbba - 3 Saw]ea P Az as(baaa : (a bs|ase|e — Saababho % Sanatearrba 5) aaa. bbabbb a r. s) aaabbarhba For oy Qien giammas Go) and ghen\ Shing (ws) sana bebo? 2 [nee “gh 90 y ghlmast drinctions «927 gh” grammes (1s aib ) ts ambiguous - ane ase ALLS /\ ae are qaane S gid \\| i ee bt a: 4 \ \ A a 4 e peor tte a distinet favse ees foy hig (w) = axa bb 0 sptiktaea - Emost cktvarion’— string (9) © saicts > tbts a setictseS > tot PetSeS iy lb > tbeibtaes > [bri btaen Second 4ePlrnost devivation’ whing (et sD ictseS : ye btibtaean ED tse S =) itictse $ =) HEA sbt Se $ =) tWiblaesS =) i ibt aca panee ave two distnet aekt eno st Aetluations tov the = tbetbtaea » the qvor grammar ‘a ambiguous - : i 1 ‘ ; sting (u)= atath =) S437 SaastS aa ats > asrath tuo distinct tetra devivalons -for ‘ +b; ne given grammar \ 58 ambiguous . i ult qe Ave Q duo distinct floss dreeS or Ung tu) «atta ras & GS ambiguous - ; - epi a? gem ard wht 7 accepting athe Same pert: f+ 4a undesirable deft sce cays 01) bs should be eo + the ape ad follows A grammar ln ty Said to ‘be Fghere $3 come ron deefinal A euch thot AAA - ay athe derivation frees hd recursive “Ln othey words / endential Foren non -triminal A, tb e is that Axor any then rie say uscth the Same ronelerminal A, — psy having deft vecursion + Lett recursion The tet mecursion, WV % a chown below - Considey the oo Anil fal Ps” Fo a? aghe by grammar in ao A -pocluction of, the form > oes Wy ’ £9 pif |e a Syd as bs! ae ass |€ Sey a =») ates ; Darass 2) aot: S =) arate ss 5 aratbess ) =) arath es 2 atath € =) axath ; one Attmost devivettovy -for the Sing = akath « wecusion bel NK aemoval oly tat The gwen grammar can be wsidden od a Sel we eee] ablaba|aa ow A poduction tos teef verursion ) Eliminate tt * marten A aeai[4) ees L yee A-ha Bm / h-> pA A> ayalle'le er i. gta ret le solid Eliminate He ett secuyStov) san the Following b qammat . ; Se cic.) ater . Ss sosis[o) ; anes ef = S ; Ni : a = oSlS RCS eel roan a atten Uiwinerting dest vetwss! 09. ' ns ost of form Bi] 4P2( «al A> p/[Be Aap, (pe th > an A [Po My i) 4a) aandlts aap AP \\y a& 4 al a BPE 5 3! on | 2s —ysbs|asb “) Eliminate the tett factoring om the grammar ' > lpssaas | bssast [es/a Solecion SS) pssaas|bssasb(bSb A=S, kebS, Bye S9aS) Ba= SaSb, Bo=b - apin ad hor debt sactoving ; a} 5 Saas|sasb A= Sa)? eas, fi, Sb 9. Att aching ia | ee of epsilon for) wot produdions - ahb fpreductons , all €-gredlucfions fom ‘the gra mods! sae & aaale @ >baa]e _ Selution in +e qin grammed, ADE BSE — ae two. E-puductions- Rand & ase nullable Vortables + So, waite with Hf and dod Ht - Sela |ale A > ane|anla Lf bes| be|b Groton BSE and cE om te, E-queduettens ' iC, Ae ey A/G, C dt Nollotle variables * avd withoob tin Atay prlueions . Now write wlith't Bre $ >aeca|tcal Aca hbo Bc|p|e|b =_— e4. p74 plana |bo P Ss yx] wyfyx]xx[[Y] € rT ad oxo a? > in|t 9 Eliminate €—produchons From the eee ie 7 7 RAAB A > onafeadfe a5 AG|tc| é Pie oe puttale vostaele S- : ve vewstis) * fallosng egamnas suc te i egal “| oe: * ons - <> Aa[s B > Aleb a > aft[8 $76 BA As ! there ve nO ae unit yotuctions s alte 9 tee — el ow, albe|bb ° PS Aalalte ts ; A> albe[eb y, | Reduce the foltecsing grammar such Ehect thee are no ont productions - to ut S$ Ae { { Ae 8 a ee (ey eo Qe a Bc 62% D>E owe buree unit Prelitions + fhe Variables ¢,0/€ ase vot machabe tom a + So, ddele c, OE productions - $48 ADA Bepelb Aen grammar there ase so unit productions - * O° are acl akctey dt ecineting unit productions ase a elas gavotte tn the given ghammat’y Bes, 4 ite praucion - ee 9 Cl a productions us The aromas alter diminating Cae Kies SAA a> abe)e{bo| ee & — abolb|bb sea A> Be(b B anh Dia? arc. Solution : Aeped First find use symabals + Always durninls ase patel Symbols - L waekl symbols > Lab) - | Siep-2 Hf thot 4 any prctuctions wlth only terminal fn xaget bard side pthen add thety tuet hond sfde variables do the wehul Symbols - . $78 Ab: useful syenbols fab, Sih} Le thee Bony prdections iy which” RHS ef ‘or Comins only eink symmbots , Her) add thety Lats a. So S$ not reachable Svom gm Stet symloo! Se LA prduction - | y gpa mah. altey Aintnating ageless symbols * $e ie... Eliminate the. aacless symbols fn the grammat - S$ at} bo A Dana a ee A o > ab Ea + acid Db pab. ead asefal sybils > fared AE J Shp-8r ee ge ah austtul symbals . faibedy Ayres} See Vaw'able BECCA aseles Sqmbols- Go, delefe al Bjeprdactins and when Dy pant in Ras Ff mmem Ge ductin sy ‘ Relte these Saft pasdetons ale A anh p Sav|ta a4 Rut the Vaslables O and & wr not reachable, tom slast | symbel’s\.- die 9 and & poductions - The Jhammers atlers e (minaling asless Symbeds ta F uayefal symbel S ~ {abs ag Aa ; Baa ase Symbols = fay 4083 weal symbls © § ab/Ai6/5 Soy clehte all pridecons y y ) p : } meee SA , i ; Be Cy “ads usdles® synbel ) } 7 i tar te gunna : 3 aslA , ave ae staat yrnbel ‘s . sedulide © gy net ttachalae for production: BO bobla c7F calac Hep wacked symbols {aby Se Boca Baa as ehul symbols = fab Ars } peeps 69GB wsekub symbols = $b A/8/ 84 Bes Variable CM ase less symbol - So Aelote atl ¢ productions from too grammar S=7 Lal : Be AO abljacc. / BO besa Pied + ut voriable A sy nol Aocha He dam Sfest Symbv ‘g). s0y delete A produrctions. - Pe 9 aber |aob D oe bofac auseful Symbals eh aby ‘ Aza aseful Syenbots 2 faiby AY shyt By bbA asseful symbols eS fajbiAi8 4 F, SAB sasha} Symbol = Lapis} | yariales f c/P} art ageless Symbols - So, delede al) Praductions of ¢ and O Nawnables . Te pr ings statins on the wight tt ae ce produ ction’ « Two of te om ost cpl roo forms Be 7 YY chomstyy Movmal form Conk) a) Wélbach oraal corm Cowie) Chom Nosmel form (ene) a content Aree quamenar Ceres) 08 Said fe te in CWE Tf all poductions 2% of the fom Dice eC. Cot) ASa whee A16,c ¢ VCuarabies) aEeET (tesmivet ) tool a “grammer Such thet thre are vo €-productions f qreductios ond seers syenfoots in dhe Reqlate each production 58,8) Gn whee n>&y for alt productions Qraamar ‘ with ee Chat Regent 4s sep boring mere than ¢uwo Vorlables on dhe right side - production fy Gy the form of variables then 4) SE the vight side of any Aak wher q % the duntral and A § Production 4s eplacd by A 7 XB amd Ka > Repeat tis Step for very qeoduction wslotch 2s in the fovn of APA: BR ave eas : sine as b 7 at Sachse ig a) -ncjaslsa| |os|= A> ae r Jor|a oP atl 4 | © 34 { dlininciog €—preducions, S$ acenc|calec|aale a? ata & > balb 2) Eliminode tril -aqnndu ction sc". ey Viedveting vnil-arnduetion, <-aca|ns]salave|>| ¢ a ala ' Bee[b 1 0 find put he pontoons thet hos mow than ables in AHS: \ a the Form of- Now find out the prdaetions which ase ¢ ; Aad. SALE, ADah, B2bG- aubsttute Da ) xt A dy oa WA ONE 43 The gvommas oi 3-5 cefaofeafan|ee|*|e . | AD vala Fy 3) aaa pane ig ‘ Remove unit protection d 4S : al > acne 5 fro Q -Y aacer S[aana j g _ subsite A a> a a ARAA 3| RADA g5 man SAAR 7 subshhde &—> Mt o a4 as|aant Sas [anna a Sana n s avs In RHS , create a ned 1g! and need) procaction dos ’ cae $9 osolisi[e 4 ) elientnote €-production S—? € Petey dininading €- productions, Eee |a g > 0S0 0° ist{n Ekminste vat prductiiy g56 ai hn ng Unel -qroductions , a+ osofoo| si]1|€ sa os0fo0 rst {u ieee 2G ->! ty oa ene “8 = calpaloslsale Se ca|na|oa| es A>° o>! eas wee oS symbol S appears an RS, cuate a “EEE £ synbot al and new ppectuction 7S BS Se, one A onal \3|! a -510@o¢[0 2) slimincde the unit reduction yg. a) vale ¢ > alte ao A > enalis}t 7 0 wefos|0 Seals : Foal ts a ox}is|t a> wos|° x AA ~ 3 bR tt) wow Find ot fhe productions which ase ty the form oh A >ak- cubstede C50 and 0-1 lo aloe os ca| ot A> ex|0s|1 a7 ox|eslo A aby dy. Gy aADa d FB Bar &, a3s¢ Uontable S av a 43 2 devmival« SF ADakco Cov) A Da s to core a given chy te wre y ebeck 4 the given CFU has any prductions, unit _Prduetions ¢ useless symboIS anol Remove if there ave ancy- 2) check whether the cry & aileady $y ewe and conwrt hf Cwr Hit St vot hange athe names of the variables into Some A} i odty of 1. ules $0 thot the Variables are In ascending ct the (reduction aa of the form , 4 i “prod inthe grammar, Li not Gn UNP 40mm, — pooation tote ON orn a7 » Convert the Aottocsing cf + WWF ' Scale B7>|se x cab Ae 7 AG% te tka- pcduelton oof He own Ai - Py? & Py Bg PEAR ram hye (Repl ayes 4qey) 2 7 | ; Berta 4 ( eilve Ag?) ye Bick ihe Rb tecursion - Reb p Ba br f= bay A= Ruhy- Ay 762] bashy 2 oo a aaa al eifee a a> pa|pel AS ade | 3 y, any prducton fun ane grommet net in ONE erry, tomuert the pretation Salo owt orn « 49 bas| bias banrang | v2 [bare 4 Ay, > [bray | b2| bast? is a ba arse boney bre [oasaye?| bane | sty? he ihe > Ay a Ayo ALAgla given groin a me tn CWE ) af te tmeductton) Sy of Bein hy Wah, HY Gas Bg 4A a|% Rages (_eploe has) fe ptyh Asta| bastala (Reploe 83-7 cal) 3) Llieninate the tet yecussion Hy Paes, Ag? banrax| ax X — viMarar[€ ide ae ell y> 6 a a7 baifyX [bre ala x~) Astley - ypduction - substi Ay geduction w fg 0 ( J { Pa bAahgXA \a x \ bahgh au b Now subside ty prduthion in Ay production - Ai baaxints| axa bictgni slants b a now subsite A) yrduchoy tn X production - th a snenat 4% Ay —pbtsta tana bash ihas}adiAs| As #7 briehgh® 9 x4 BoA lari Fa, baatek |x| bAsts| X bash XA AgAsha far agt| bayiyhitastel artsy basts| brs] ana tnx Panes | Aifaas agx| PAcAshar : Remove unt priductions tee $7 6 ~ c-seua fle A atila 6B bale | a) Cont the grammar into CF. a iKh |na|ce jn|me|> & >yala & > 265 . xk > AG may = & 2>b Ar wlth Ay B ulih hy 2 with As YX with Ag Pe ee] ® Hahs| Ay [ Pats] Ast] AcA| b fi3 AyAs|ex aa? AcAy|b Ay > Aghy. oo) fe 2% NE yt Bn paduchon in the gfarn mat Ss vet ), Convert the production Slo wit form + Aya ty Ag Age in Ay & Ay atte A, tr Aa FAL and Ay tm 4 a> rs aera] ary] bayAalbtalanytslanl bry |b Ag, AVaAgla 1 By WeAu|a Ay arsty\any, ae hsb , Subsite Ay in Ay: aAyAy As, fant ansa tag enshanas ans iB afg [a ee & - Ag AA e- Be, i fe of th ath) yak then f<& te preduetion ts the mA 3 ae AAA) [- 3 Pathan (Reqlae Ay > Patala a) ¢ the ted veeursion - ) A » Fahy [a ag > anise F ia? Ag Ay 8 PQA ay Af any peeduction tn ce ro a — Convert “to Ue - Subsite ay tm A § 6° meres B= agit |e ee) aayo|an|bs|> b> ah0(6 Janre| benie| ba achybhy|a ay] 6a 7. CEL SatisheS qepg ee. reply the perping Bemar cr farnguoge L does not sattisty pare) Loot CFL: (& Honguage L seis fes the porpiag denna property ; L nudnot be ope = aaaaabbb eccec G3 6 = abe oh va 535 pat In Ant gran ngage Lefadore [nowy 0 Ane Janquage Lefarere®(n>t} Gy nok content free Sanguege * es aaababbbh cece ny vat me Jorguese Le& abc" [ery mae y Be wol CEL rabbbbhecl atyte? ateat® Boot Wn the gern Sageege P= 0, thr ar gasre?(nery So, te language Lafarge? [nosy 2 net tonlect fre (rquede 3) prove Bho Hy Lorguege Lefer |w aw eet" & vot Corksk fre Janguoae - = obs = Pe owwide the ans) crue = abab abob wry = abbabaala b t ( ( 4 (Fie Hing avedbontal ®t ts gt babe” CU { { 4 i'l tnges Lofts Gail vo a r very SH AAAAAAAAAK ‘in te lorquege L=fa'fn u cand $0, He Shirg gagaaaqaaa C10) fs wot Soy tle lonquege L=fafn & pet by net ote | | ! Un t ar Fh Lyard ty aw two towtert free fanguages, den Ahir Ll htt also be context free Example + uy = fare) [rey cen for Ly + S|, J afte oil Q =u" |or03 CFH for Le ~ by 3 ¢ Bale union of Ly and ly eae Ue): farwryofcrd” Y be Urls -gageu ne gre} crO foxy L 2 , SSR } 7 ey alo contr Gree: a? asjblab Saad) ad ecl 3) Klene cleue® at Lt a coment fee longuage, fen & & als a Contert ves Bemples L. gerv fred crn for Lo s-pasble i = Sar [nz un for Ue a, 985] €

You might also like