0% found this document useful (0 votes)
35 views61 pages

ACD

automata and compiler design

Uploaded by

Mr.Dracula1989
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)
35 views61 pages

ACD

automata and compiler design

Uploaded by

Mr.Dracula1989
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/ 61
E—aserv O esr oF %» FP FO Se ee ee nae oye, $e with we merchines - tore eBoy” Ciananedacy a Iie. Type-0 2 recursively renume wale umestricre ol tpinmm aT THT RSR machine 3 turing machin & Tyrpe-b 2 cOmtEKY sensitive (Lang) PNEAE r 1 cenetive carammany 2) Sarteryyoe races + Linear Rouen aA CeInNare: type a content wee C tans) 3 content wee CYTAMPa1) machine: puch DOWN Automara TWype-3> Reg ulawCLang)—3 Reguiar gm) machine « as Automata > only yt ¢ in cutouts - NEA Se Einike automate tuo *Ypes — Deremnminic ic Finite Automata (pray pinks auromata _non —dotermi nigh " Peay i Finite Auto mate volt) Out PUb nea (wen) -wttnOut output —> deterministic 3non- determiniche 3 é non ~ determi nist faa) Finite | The basic e1ement " AOD pe tor) the ematiece building Croce Or ae: anguass : SNR pon te A syMbBT!-— SUMbBOL | oe d Shing is set Of symbols Bones rom ane Giwn alphabets - aipnabet (€) aset oy SYMPHUIS © Z=larvy - > : Sting = Tarp, aAb_,AA bay be, aab,avrmaba, -.--- tengtr ey Sting is ne number oF ch dracted . alphabets to a given soord- Oen'ng > vo E =Lorby tent Crr9)-7400| b 2 worde ? {erxing]=2 3 terering) sting fab, ba boi any }= $024 [erin g| = > SENG={ O0;011021 10710125 20,21) 224 t 2 40rd - Language is a Seb CF worde ce + words) concarenation OF et E=faiv , re is O.. Chm adia wo ee elo Garey SiwWlel ae 3 i Fee twl=2 3 €7= Qaasrawerbarbbk = a4 © lwlee => er = aaa raw abb; bbb? a Sy Wi Wr ave two StIngss FOe™ concatenakhon Or a §Wr2 j which is given as CUOpW 2. examples i . wre $ar by oGarb,aarab) bas w= for WW = F Ao SOIANOs 2). 4F Sooaemes bo ~->-- 4 < @ 0a, 0b) 0204 Si a tee 4 Prewit? A sting dvrained by removing Oo OY . more . tailing symbols is came d prey x: OF a gmng- EXaMPle! w=abe ‘ fay at sabe’ > prey: PrOPEL pTEHKEG as aby A gtving obtained by vel etik Gattic OF a WOTA is canned the © > SING - Example we AQOS Boge 2OREVO Wea then © 1S & eubseing SF Wreren, eeveyprcpixn SUbIX Or sring Wis a SUbeting OF Ww, Ut ice ETS Soe noite SMe pon Wand Gare fol cubs ngs % w- input aiphabes € is a For every sting W, presixes, cubrixes Or | Language Language + OveY O& covlection of strings , where PH ECG are the Languages- the language g Ie unctetined OF Similar 4, Infinity: Eek js similar to an empty getyi-e, eae 72) | withour any sbing | Example we = $a, b4 DH etiiea Language Which congits or Ser Ct amngs o length tie¢! = Fa, boy * Lo 16 set OF SPOS OF length ». La > £?= Sao, abiha, bby " ve APOE. Toyo Au ( as oy oan = el oo hag eauat Be oe . Si + % FRITH v fi La = {©100; 900,-- -- & aime a LTO PP EST IDS lo = G wl] Every character in wo tS 0] — eS one tes OM 2 Nn SIG 22S 6S, O12 5-815) Ly = Soir, O01122 » OOONN227 > =~ -4 Kieto closure L {6 @ language over o inpur alphabet €, tnem the Kleen clocure oy tanquage L 7S denoted By ste Lt which gare Hes a PHOPETHES ike repexive (transi Hye 4 closure , woh ere k 1 €* Gonsits the get OF All words Over c. 2 Wow ot Gees Positive cure Ih € is the alphabet Sse peels Closur re om € is denoted by et which consits m wop 224 é*= Quits eee ee 4 | | + iets utes 24-2 Finite AutoMate concatena non: wirgook, r= "4 (dg, =r Seoncarenanon w7 ool’ TraNSpOS e+ cnatl= aw = Gar oy apbh © alah b ae ab anz aa | gle bhh abo Paindrome * E> {oroy patindsomes = £41 2 904s baby aa, bbs MP sbeay, Ab) B= Laut) +> 24 Nir Pain = Smo, chad anna aka, anna , . .- y 2) hong Te AY = B10 011 0% Le on YX= 0110110 5 3 } 4 avs “wBhisy a 5 ~ ar = Woo. eee ae ; nig ae a | Describe the youloding Language Over E=Larby - - ee ei Lye Aa AO, ab*, ca Ly = Fw] we BEE, n> oh © ab” L2= Fwlwe arb, nz Lr= Labsaabh; maabbd> - - -y Lo = Swlw has equal no'ty a and to »b tollows ay. La= Larb™| Myn>ro | La = § b,) aby Aaabhbs et La=fwilw hae any nor a's forlowe ol by atleaes A by. eo: Sony Lys (wl wis a hs {w'consiets oF eauat noroy o's & 1s binary integer thar ig Prmes . he 5 tuple 3 @= St roo € = inpUt aippabe & . & = wansition lebite 2 yunetion Ls A= Mitiat stateeq Fe= Final SrQre EQ Co S=€x@ 3@EQ ; re Q = 1071 41, AH e= Lah axe =@ {401% arg x85 23%? a wn 47 ADM 4 3a ts ; ' pererminishc f gre7d ongaa a single inpur sre Ach to One State. non-AelIMInistic > dinerent inputs same otate RAnr0k = Dy . eS SS eae! Ly 1¥ = Ar : Se ASS on 28} £42104 =~ vot 2 i sp nner SAa nd = Ms r a il §%3:0% 242 aes § Van =U : L=$eee op aw otings erarts with a eo fary ‘ , a 1 L=Jaraarabaaas aabs nea ACenees -- + & inhinite- a pA Language SOSO_ as Trop|dead crate oe ae oe OOO saree AS Ay 1s MOF aceee final stale ean Scie ee fINal srate prom coe inition State nen sting is accepted - e¢ accepeance - : B Finite AUKONATA Ae eatd to accept & langquoy fh tt accepts ak the stings avoilaie 10 the language and cimilorly, the siting s chat are noe in me language must be re jecied by the €A° consmuction OF & DFA yor a Get OF AY suings 2=Law} ,such that. length OF Sting is atleast 2- =Laybk » (WI 22 L=Gaarab, barb Aaa, aab, Abb aba, pbb, haar nt 4 Dro a18 a) ae oy tenam oy armoet 2. parir =LTarby , lw) aa oe a ba - Sa DONO SSs barbby eben » é Ab wragltercl. Q=§ 401 M1 Aah ed ae ‘Sa Sawy ur Sere A =o ay AB z FE A414 | (A= oh a, aa ee . qa a, 13 J ® ©60OB accepttc| weyected Ty whey no" ‘Dp erates = N41 a4 IWiSD=) hod, stares = ante Y wlzns nooy erates = +1 we e=farek Ayre HO. g 14277 ee ten consttUcte a oFrA Over E> LA dy no a's 1D g gvingS be even & dhe Abs Q= $4591 BY is €=fob iC Le a Gp =o ae c Ex Spt ant ,wohose e=Sat¥ L= FAM AQ008 ayo Pee oe, EB oe r a3 odd No OFS Sonny 33 oy 8 E=Varey | £ OF ewHe Fe Nery Ue fayanibaraee, aaa ys ¥ callin (oS pa” SP aat aee accepted + reected E=Rarok = a b Qe $a 5,4 3% a Oe am % eeu z Tray /leod Construct a DER where No H'S AS Brecter than 61 equcd £0 4 Over @=Karok L=Yaraviable» a, pvaer--~- | Q = ep “ov “UD come . back - > COD ete er cena nae Crean st each eoing is end OIA L= $00a% abbas ba ,ePO - Pay no deod State b = ky pur COME bocu b conemucr a minimal DFA Orel S=Sajby and each Shing stats with Ab L= $a aba; abaa, ab, abbb, y ecoosmuce a BEA ending wite: — oO L= fale», Ee AAANO > Se 5 + FF PN Eee aesete ad : : | de pasion Tine L= Lat) aay aabn anabbb, -.- = °° 4 oe at rw90 to each oln® are aepired 0 = pet eSaie’ bind pre which ts having even tengkh Oy sings 112) odd \ength or Si4 We Uew ao bh Aan bobhs abba aabbs---- even \erorh aD arb (D L=QY orb) aad, aba, bba, - - aa — Ai § odd lero _ e- @D) aylo ronsruct OFB Over E=Jar py hiner every % i followecl by 4. 7) LeLab> avlans apanaj ere 4 Grlacad ayo DFA where a ts not potlowed by & L=$ ©) aar Bar bbs bam AAA -- 4 aw oe ao L a Qe a2\s2t Sesian a OFA Over eo AlphabeteLaibe Noe etaring WIMD a: lee oieea ee Aga yo & 55) Zhe , 2O=-2 a 7 AP *. A, = Oa DESIGN A DEA Where every a Is followed by bo 1b ‘ 12 fab, aloabyth,.5 mirZzo L=LE,a1b6j) 20% Wola, aabor~ 1 i — constuct Q DER which acceprs & language L# such Mat aNb®ct, @ hymit zl L= {abe, nabey Ara beecy = --y a oP 3 % such Hae W= fatyr bwa 5 ovey L=Q | OMY WO “Dy | | DFa a's b\< Lz S§abba?, abber, a baay----- y Le aaabaaa,anabbaaa, aaabaaaa, Oddbabaaaa;--- --Y COnsnuce a DER over B=SA¥ SUCh thot Lei or Mmayndyy t=fe, AZAR AIAAAAD ~-} Operations jn DFA! leowion @rconcatenanon B-complimen & G-cmss product | S-revert ur - es ratie lt por the (ANGUADE L suce, nm RHS asa g.conStuct NFA : Har wad symbol. FO Le Laar avy aab, BAPIBAGs saaat Q coven VER. nea stange ee od Glance p>) Gierese Ww | pom aus fo a- mere SENT Cl symbd) LEK AAA;AMM.) Alb, AAAA, - - ~~ f ut AGES) “OD - anely * ; Re ts construct WER ” meni Vow NEO Over S=Lony constuce NER for si Qa) @ ' @ ° .@ conversion oy wea to OFF ‘ A transitfon & NFA 3 OF | 01 oy to Over &=Lonk . 01) ? | | ol P |Seaks |P 4] = | v $ anguage Scocic sao nee ering? OF ANY MOO of > Fonowved PY omy ay, %y te, cena by any poe BS OM" Ca Lot oh © se ea es LM" [nzoy ) ROM 66 UN AD Cure t cer OF au 3} HAS which are seacnable ONO Srare PB or wut j 2 0o08 £7 closure (ap) = L201 Ww Ark : t © eclowrt (q\) = £0,008 ExCloMre (yea ioott a : eiehtea ca9> €'Cao0) = (ee ioedve cee. e %oré),01) Sectional sle-ctosurs¢as soy)" =e-crosure (£( 121%) 44) 10) TE chOEV7E ( BC 101094) E (O40) V €(2510)) = e@rclosue ( %0 b vp) = €-closure (4) 8100103 = Lag, UW UVY Nags!) 2 er eiw sure (£(4r0 $444) 0 & (45) = e-ciosure (GO vp) = E-closure( uy Gi Cae V) =a ny 8G yr) = E-chosure ($(40 Ao (2 2 e-ciosue( gugv WH) = E-closure( %) 2) OS( 42 2») re Cl ose = 5 ‘ Cou as ¢ 0) p 5! G v A iD) c aS toss ve US CA 1 &'l4. = a) = ) joss re C ) s'( DL 2) ane ~ CAO ¢ w ne C&C an »2)) ae =—C U osure Cu! CREA Se ) . e- gosure'= Leb * e-dosure (2) = & pak C-AoGee (1) = Lavy §(e,0’) eS e-ciosure (8 (8 (p> €) ,0.)) = e-closure ( §(Piany = e-ctosure (¢) | s'( pa") ze Oe e- closure (EC S04 = €-crosure ( §( Pe) se) = E-ctosure ( scons 0s CMe) =€-crosure (aut). “ SAY = Spray ee ak Sarcye @-cAosurc ( $ Cr) ro) = Ec losure( CcpcdUS (a4¢)) =€-Closure (vu >) = |@c lOsar€ Cr) Maye) asrs a 8\(4, a) = e- closure (808% 9 ,a)) = €-clo sure ( §( P4117) 1a) = €-closure ( g(eiaju gaia) VU 5 (2) =e -dwsure (Py quit) SC ya") ={e,2173 “pay | ~ fa Pay — far |Par! eax Pe | P4*] pqy | | | | Pay) Pay witia € Ce-F PD * . $2101 HY E-ciosure (710)= Lar GOSe WEP “E-ctosure (=U e-cios ure (2) = A e-ciosure(as) =A elc\oeu ve Aa) = FS \ = §\(409D) = Eclosure ( £(4050)0 &(410) VU 8642209) = e-ciosure (Gv0az, OF) = Ecrosue lM) ate $'(a0) = e-ctosure (§(4091) OC TYV cass) =e-ciosu eC $147 P04) = exctosue (ee) = §'(ar 0) = E-ctosure ( 80% JO) = © -c19swe (A) Ee | g!( ars ee closure (cor s')) =e-crosure( 6) =P. {Car 0) = E-Clo sre ( $ (ery :0)) = e -crosue (OIEG™ {3 sure (§ Cord) =e tosure (9%) rane | § Conn) = E-C LO | stevexe) = €-closure (§ (4328)) = Sees ch) 1 ? -ciosu ve (2a) =H SlCaa = e -ctos Ure ( $ltanD= € s'(Vasd) =e -closurxt (8(%q sD) = encrosure(b =P $'Caury) =e -Closure (€(7410)) =e-cl Ose ce “2 iS a wikkout wut NF denotes emery seem . ge te a mequiow exprecston which clenotes the Set Ley 4 Singleton cee- with © as efement which indicates a null etring- B.Eoweach ‘a in € ta’ tea VEBUAY expre ge denotes the See Say hth 41S are Reguia expre ss'ong denoring ae languages ti Gla then w+s [Ss equivaten, FO Livle2 » 9-92 Lyrbg Seoncatenabon , ots 1% oxieen closure EXample * l. E=fah ope th S650, 0.04 aaa,--~-4 Ee ReE=q*t RE por the tanguage WhiCh aceeptS ath rae Combinations o q OMer @= Sah RE= ot oy, a ee ee ee 5, eOnsmicte He TEQGWHtaT tal Tha 3 Re Coriy>*® 00° roy SRO Ze QUIATE ‘expreesion maccesting ermings cobich are stating with Bi and ending with’ Or” Over €= ony oo ee ee as RES Wi CORD Ome te pe eee a + ad: det oO au seings Mat vsegin with WO over weut € =Lony RES Ud (oars : D3 74 SB Sek OF AU Stings tnake Contains exnactty 3 ts! Over S= Lan ee O81. 04.) .041. OF oo, ger OF ALL Sings Such that No-H Ole are Odd over C= Lok - ae ace 0 tooy* é + 1B. vem string a? bien inzy 2? 14: RE tO demote over Langage “CONtGining B= Savy such that the 7c, Charactey ee ee ee from RHA FS & j PREC “4 | pE= CA4bd)%, arcatey- Cate) I5-RE Gor Lanmquabe containing [ti at tease 8 UE- over B=Laiby Qs with, | RE= (At). b-(a4b)4.6i(ate)* > o as GFA) i ae | a ARE XO denote tha Language over E=Laiby Such that all the Smings donot eontain ab. Lefe1Araaitotoa, Baa----Y pe= br a8 Tdentity wtes ne RS ‘ER=RExcR " €¥= © Chui hing) (P= Cp is empy sting) »r= o F peer ged + GOERER “RR aR 4. Ret -ptp-gt (Ri¥ 2 pit t na on et oo ns tO AMgvortre [tan chang a 3 ee QreP ym Hz EU 5 a2= Qe az eat eet eS a = a, Sse 42S Sap =a ae an] Gliese ee ===> Ay = Azo + Aay+A2 — rae : le = tair+ aa SE ee = = OF = ot eee orl pe — is ae ON Set eS CON £0 ©) ©) ap = E+ (04D ao = €-(o+td? j i Lae COXA eye © arte Ure -) : a= aie 134) —~Z) | an~ ea Oa @S gulo ® in @ @)Sarb ag >€0 +22 (a46) Ag> ‘at 92 (at's) aye a mew” 4 C6 Ap = Ularte)+e —~0) ae TOs) eS az (a+b) —@) suo @ in (3) Qe Ap( atb)(atb) +E Ao = ((axvy cared) sub 4 in © aN =((arb(are lars) FS > horeshaow OY m> 2a 2 PAE OTA” a= NArEby © . eae 2 Sti he SOF = an Oe Az= Arn +Mbprr25 & ‘ ee en oe a) : 4 shar 2 is mq WUtar - -aoaueenee av is also. vege + concarenaton | or Be suomomorenier? OF Zeus eTOVETse no mo mb7 phism OF res fc cae 1S aco T Qua, epevicasions oy e's: E can be modeited by Finite AULOMato eppplicationc + —Text editors -Lexicas anatys ’ 4 ~ ‘ ecompile? 4 trang iare High teveL to Lovo 1 een i language 3 complete prea? or: erprer preter 9 come ac compiler? but Iine by | alate * \ agen een Une. 7 ‘ 4 SC Wee by A i OOK Orn Af site Kd 4ny fh OPH wate , ‘ eee OS 4 ir — Jeverose | Tv be a supe comtctions) ) eek Ow BE {hes Po | ome dove “ Coup | Idewkie te pi ok ay Wewtoney Some Hod ul | (dentiders Syprac drediong enone & d code aur betp In bre 4 ana fore 19 f balld a fymbot talele Syma ar Ind are catey gree {h any emer Ore wu ried Tokeng csap i inp Ac jd \ ; Ut AF Laci 6B) 7 Re AIOE w compilation mie Pie Bore sia ty ets 79R ears) os i erg Seer Vent cat Praavuset e Saale Bete AIRS 9etg9 “9 cha ie arthiok fmatyel s ; synraxl “er Lyeynras [wietor Chet ok Jearce wee a Weraretviar snk tOKeoSs and korn FOUL oN ved Calteh iS Conucture folowing some MH wecuretve wiles - Lidentger is an enpre ssi0y) a number IS 20 exe7e scion ‘trend Git Er ' Bx, ee yrenrprecsiod withiO parante Hs eo also Ce PreR cy onpre Ssion * Be th UH GEr Ae 2 expre S SiO, j | Syn an Wee em = assignmen’é BAe ae > post hin. + sdewkney 2 oprenston & ginnin Posture ae , 1 i) a ae role gy \ pair? =~ | oe «© & polo = | { saeakiiors nuawelet! | yale ¢0 oz = ide 62 RA =e Ae optimizer: improves the ar=60'0 Qacan ee ya = jd2xt2 code generariom ememonics are used td exprecs - mov ids» 2 MUL #60)22 mov id2,@\ Add As R2 mov 1, td qdridxid Get ES EKE fe Sid Ler: mort chen va om 1H CF EKE dt ere (Eid) jaridte (e314) vdtidt (¢5fa) pasne ar at Atri Sd tol 2099 Ferny USTs 6,7, F | | | soe oe denva Son | Mp. EF EKE | e+e tel Gt idatd Eg, | idaid ‘ Tere 99D ¥ eg e@ maker Unitation oF ee eon chee are | Jerk suitawie to ateart peor Stiwpte computation onivornerie expreesions: 1 SA OOS Rare pits uandg “Cr Wwe cain ONY cone ne © gyRton Or LEAS conspace Ue we can aad cymantic meaning to ‘ ee. CFA production; hen ene wecUItant lovcomed: + Cyrax Oected oetlwition (eon) : 1usihy EDO we can Quicle tne parecer 1D pevterng | eoaluation | computation op tpicat pL constuct irre Set OF all wanslatroMm wules agsociatead wits epp are catied SOT (tyntax Directed Transat The wes are . ; pagcoetatinty ’ a Prececdlamce et ASE jon See Hien wrt ON 09 su ots ann ene Sah BO I i7 oN ae \ cat Nomen ala BOSS THe e is ty the PL Wants TO Ger the proPperty g AAgnt associativity >f-e Wong Tom IGghe sole econ com aaa ° Chat the prductione, are Mah’ preennet ye nee Porm mMogwr recut sion. : er, productions have amiiguits > »ened elfitingg te gacoclat Wry, ambiguity § then eeuorm | | | | | | are mequired by PL: gprecedence. J hte with Fespec, Pre cectence OF operators +O NUmbenng OF Qrammay wIhe Operator which ocaure MYSE wil hae ene least precedence’ and which OCLUY S | last will 6 srhe least numbored groductio® OP eA tory will pave [east precedence and weetersq . 3 waht precedence. productiong. ave nignect ere cedlen ce Woweit nurrbere dl TAxiA AISAG = €> extlT & > ExT ro te €5T Foid + OTs eekey TOR Foid: S ExT (Ce dEXxT) TXT = CEstTy THEAT CL torre) FtexF [FoF] : 2 . 1 + Nae more price deme pee ' gray ida ¥T Lr ord] idaraet [e sidd Q4+ are (roe) Arex td edict) QtDAY TI ya<" NS tert =e St Rhein . Cour Sirs; cto, ee oe coe og | | Twegten mags TS z Bese trae) | T+P4E [TOFD Dt anon | raeatd [roid] | Tea ieee : 3 | ergau [roF) yd + DAU {roiad 24 B44 AY proigai ry: goers lE46 | ee) lia BOGHE + EDEAE e3(s) Se &otd ve {ey c= {64 T= gris idg Ax & [esiad (A+ Gace L © > tela) Laxtdas fesitdd taetdtld Cesial ae : sf iel4gree Ss “Gon CS Exe [Le tasees) let £ > E+ERGE (eTEtE]) A+ ERE Lesidd -\?sS387 Mogg \dxidke CEsid) id+idseid (CesidI s3as Sb aaabaalb = Sta ane Vax Se ave S=tsy wwr=9s4, Te Ga rsor€y ep art. bees A) as Co as as a aes Lili gh (oa b i Aa Aa aoe ae TotTarle TOTAL TORT ’ WE = | tS apt’ i - ores Wa ¢ {Let pactoyi ng: HM api) Xk Bo ) ASA A> Bil ee —y \e44 poste) aoe ec) jerses/a Saitessila sl5 e/es- CL, s) g Lois} “Ss (sos) §r3ask ee! (ars) Qsaay Carad $saay ( (a4) Caray) Ss ce) (secu) Ch) (L5u8) ) (6G) (1981890) Chipeta) (sed) Gre (05, G5) ag Ca wo) S (cus) (3) a ue) iK (C999) 1(09)) (£98) (eS 634) of (aes,covm) g tt) avy 9) Se (Ly LS L | | ad 7) aantbh ovo P| Aaabbh Abbe Aw 1 Doors a Saas > TOOT TOOT Too it/é ON es 1E00T rT50\ Se Tee rast

You might also like