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

Compiler Assignment 1

The document discusses the differences between compilers and interpreters, highlighting that compilers translate entire code into machine language, while interpreters execute code line by line. It outlines the phases of compiler design, including lexical analysis, syntax analysis, semantic analysis, optimization, and code generation. Additionally, it touches on the advantages and disadvantages of compilers, including their efficiency and memory usage concerns.

Uploaded by

negiabhinav57
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
0 views

Compiler Assignment 1

The document discusses the differences between compilers and interpreters, highlighting that compilers translate entire code into machine language, while interpreters execute code line by line. It outlines the phases of compiler design, including lexical analysis, syntax analysis, semantic analysis, optimization, and code generation. Additionally, it touches on the advantages and disadvantages of compilers, including their efficiency and memory usage concerns.

Uploaded by

negiabhinav57
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
Name: Akanksha Neg See EAL Rot No:- 0F P\ssignment- 4 Compider Design ° Qi What uo se , foo olees it differ ftom on intouprete den 2s mo teorslater thot Lokos opt ve High od 0 é Li oe hangucat 7 Oxck prrdcluce On Gutpul of toe hovel Sept i machine or arstrbly Larpays- St porsche koole , S [Papoaeg Jonpucge into vrackine cele eras 04 ena 44) > A compiler is more catellient then orbembles, it checks att hiro Of Lit , Ao 1 CEs Le > But its phOgbm Kien time wk portey mem 4t hos slow 4ptiol because compiler 9 Hough ethe, pat and then translate entine phiytorn unto ynackine Pe ws evel ___5__jnturnecltate . ae Machine Aamipstty Compilts Ax ; rv es $onpie Oder send foster ¢ fe gnterpreted Lode > Compiter Aekys smprote Aecusut eA se 2 Compiter Tie Debugging pool , Aetps I fg cout cote eer 3 Gn nly Ayptare ann, demaclie ONES, 5 Take rere time in coe Se cae Tat expects 2. ina pre That tranrtater a pre -#e ee get song Bt convert He | dh sib on on cntetrrnectiate Dt Kenkeuns pre LOmpilecl cone Gt athe 9 3,0 wtdtten in Pan pate ahe Casirr fodet a 4 Tidpreter atlas rhe NS mMememOry guutd, eo pohich reduces Tremblay chk mt a mately. 4 Tntupreted tanga us ore fle bte Har Comp lek fropicy. ls P Inkrpreted code Aunt dfousee ih Lomparedn © Copmeprted co Coy ompi hes Taerpretes » Compiler power Machine Jog mom 4) Srtesphetek pleas rat Aove whe of Machine (ode @n dint ) Seo y w Linking ~ Koaling Meclel “4 basic {ily Sate Aétatio, Modlet is Fase Working model ay Conprdeh WErtking model of intesspreten ro) Gencrase ovlpel tn fobr of C-€88) Tn) Nees net generate ang output ¢ wy Pry chong An Soubee pegen Ww Arg cheng * Source prepon 7 aftr the tatian Kept pranslation deca not KEQU« Ke perernpi dng fn eke entihe code camtcstaties of entire code ‘ WW) Bow not pequined source conte y It preguiker Zoe code for lator enrecuten eo Lat or eeetutOn on kaos ane Litpelorged in Commp Vi) Gowrs ore displeged kn OC hey eh at em comp eye Ange Pine ” vy | CAL ufileyation ume meaey fvny CPU whdigation Ja Lem 1 Cou ten Jabespaeten - pCa cot oy Ruby» Pythny Peat: ere the different plats of Abrmpitese wsith buttehlle Diagrom CAH Leorpi Laren 4 bvicled into 6 phases : i hence Prallgsis 461 phase » where ounce code a KOR ¢ don itd tokens Sth O Aeqiorate ope , (bent per {* ean processing 0) Spptax ig or Parsing i - thi, prove checks y seure core owes the Gorruct Syntax sutes , Suiddirg a pode tH0t il abstract Ayrl arce CAST) | ® Sementic oo It ens e Foyt make sense, chucking fo" Hors Re hype ome el eed tebe Guy drteuned tote Code lon: fy this Ae 5 Moen Fcueats the source code wnfd an Artemme oliot ¢ mathine — end presentation simp tiheg optimisation del thei Ph Tana v) Code optimipetin | thas pROe Aimy AOVE kntek mecliale Cade 40 mohe ie oe mote effiubart Pealuct _ Serine | , GF Resource Lange oy | Top de us Joost - Pinot poe ae vr je wher, ') € optimized code is _ ONS La aaa Pot . , 2 Ln Af Entcuted On CArputey Abanksho Nem /t 4 /o# Markine Code Sownce Code Hiyh Keoel ares tes Tatermentate (ode ws hever Zn 4 — ‘ ko os Phodd 7 Repruetition Arephe cs < Font End v hoon ent oe Levul anak 1 Sypntox Onayy® , Aeranhe aralartr 5 sitermnestiote.. Cede oprmizanien , belle code Prrrr ganna ane apsernbey Source (ode > hericot Pratysis \ > Apri Prraligsss Remnant. Rratys'4 ————1 Syprbok 1 rot tople tpbermediole Che _—_? gpereeton i ee Code Lon sri 3ah 4 Code yeresoion Machine boaguage Coe 3. hat are Cousird of Compiles T hercribe Loch briefly . Louis cd Lompiter case £00% cee ASIbt in Phe oc Of tears latrg g executing payor. these 700 perform kooks pelatess £0 cole pooh Chan da eeendion - . ocemer !- performs ne - provers on th bere actual Peete. 0 me rOtHO experts 0a te etsy e Louse Loole AAsermblendt f- Kenvects Orbembly Longuept cade RO G 0 Mathine cacle Acts aa 0 bride dats ein Human neaclahle code ancl bint mathine anstlreliOn - Srdvopnt Ons - execute code Line 4 kine without Larveting Gk unto mochine cae begere hovel 5 ptowee bt vseful {or debugerg « ‘ LicRe “combines multiple Chject filer bale * Ainghe executibte tite > Regolwees external meeferenees Aetsdtin foretion and Li mason - koala enccutabde pode into Mato | Memory Y Memory * tilocah'on. hoasler * 4e% Gy Eeecustion > pete ALM gy. Sus vassious Comper LorctuttiOn soeks avaiable $o buileling a Lompiten - Her Corateunction foots Aelps im Building aippone prose Ah Lop lo effisenlly . / FLEX) = Yenetcade tehens pron an Peale Noe be CYACE / Bikon) Lueate parsers ie (neck Ade Ave netocation a. ntebemectiale (oc “plate - LOnvet Code onto fesenk oer dike thee olen Conte Opto jatton:- inprove perxotnance soi thot attering rolity - 9 GCC: Code dennis *- Tron Lote inter eoliaté cade “into machine cede eg Occ Sgrrbel Table Management Toots «arene inporenatren about vasuable forcters ey Ltuy Foor Honing Tool, .. Ketect & report errors dusung Lompila hen g Clare . gs. Vaat pre 200 OF he utea? rsalysrs oo det x henucol where Ae bequence oF tokens - pation !- breaks the source Look srto y Toke t" koh En an Remoning vohitespeceshLommerts *- - 5 ores 9 obs , Read a block & input fom sousete coole “eto bles, and shen prouess that Bff% Syore neoding the next Afhock - 5 Adwantage fino buff“ *- La 2b Ldn 1 pedluce mo of system ls eg aba AO reo Jnpuk prom the 4osee code Airte eorh Lystm call cassues Keme pierhtos! predicting m0 ey colts Kaan leprove erfasvmarte fo dea It tha kacknigue vol dapat in Losgete ard 0 Niuadwantage S178 “ bof a te Large, ik may Konkume too much memory , Aariling XO blot poformane on ever sashes phactshe negt JE 4/07 Compiler Design Lab (PCS-601) MH: Wsike a short node one * a) Yace: Yet anesthe Loonpidr compiler , DA tol tUsecl 40 gensare Lyyetox avectayt a Compiter canibuttiog y~ St Apher ¢ amos dlefinct & 4 prooluce C code perm ped : as input > wrdel Wired to aeeate parker os context free P WCHL Sg Wed fo poe aseithmedlic exprenien - b>) Paw: > Regers bo the traversal Of Avurce Peet Prt ermecllate code dusrg compil eb'on > Aine om oredr comptetes oll porpile ten proses 40 one 0 > Mutti por Compides: -- breaks me compilation into mult pune to opting cocle br oletect errs ef tinety. 6) Bootatrappry The puoces Of Lotting a cong?! tn the forgquoy pdr faterolel to comple wtutten im C oryuegp : eg AC 6 ompites Ler AKANKSHA NEG! FT o7 LEX Compder Aharksho New /é 3/04 Jer > tot wel fo generate Lexical antlgay 'n erp” App rious hl on > (onert betes sregetar ert identify foens fn source code hey Wore » iolent fie 0 ep meidn ento, C code Hal 40“ nates Se necegninicg Hey GB. Toho, pattow ard Lekems )- ‘token: Amable unit of per 3. ie Rates that Aescurbe foo f ord wr Megylanr ex rm : e and aA hex enna: an fext tok matches pattern convert eal into a en > a , a Se 88). HP ea aa anti an nthe pollo? force sooe @ phat are e Ccte prt (Helle vos ye hewcol avlipyen joked fies peker in the 20 = 4 wing seeps ° Louch code chakorter eaoling gt peas the 4) Snpt R ig: 4 rapactel Matething * ge ures regular exprenien ak fut a) em po > match lnanncterr heguerte 1sith plein pen 3) Teken wee code. eration y phen a patletn matches , Ahe Leyu'eat geno LMA iro kOReA eth td Ages . Phaphsha NEg /b 1/04 ‘Compiler Design Lab (PCS-601) 4) gnoreng White bo oe ee Lommets s- St MIA OOL / whispers 5). : )- Broo Table Entry 2 HH breher identifies % Korskards 47 Ayprbsl sable: print a f unt La LIOn [yo of tokens = 5 &%) ws Hetlo wdgrtd” Ateing Bkeral $ ) punctuation fi pouminal™> 6.4. pinscu sipriticnett oy megln expren® fem sa Rralysis : pute scepter enprusion Be a) RR c ate fentcaterstitin :- Re RRL bbe ed by jataing OW concatensting,R | pfavoce™ny'a2 ey ab per ethos RI OF R2 b) RRR pep etinens og Rt- K 4@n_CA ey(neai) K 48° Clewsre } nepal oO or more 7] a” Ayiecaiy" Ptiee hawwhe nepresels 4 et mee repels H&S g R) eg at Bigot ficaner \). Patton Matebrg °- wsedl te glefine £68 hepwsorels operators Y constant R Token Recognition 5 3) St lent OX tyetection:. Netects —invatul Scpvenee of Aovree Lede Y) Automation». ect «cosh generate Aericat anolyy 5) Waite expression end with ob? ove (@ |b)’ abb 6) womise Heaton anprusen for Language | ¢ null abana AkanleNen at 4/07 chen Pos ; 4 Helps the ex aod anolgyes teers £er +he vapput Code characters an bo recogni [he Len wae Sigler enprertion #0 autorrat” Languoys forkas ring artdngs hich erage feseiring aut sAtdngs devi ary no aos GW excep (@ {b) Cal b>* Q.10). Kod frite Er a with & exprernrion © Cotly* F Te Keogeiye posttesink Jelenb for this Aeps into tokens , whch eo Sdeck dy Pottonks ” ao fay Detect Bons » ‘ fata mata Used th Aepicol analy’ 49. Construct DFA to accept wegetorn (00 +u)Co +)” in £ext Auch 04 Requeras , operators Konpites break olouin sorte poole rakis compiler eastern to proven . Break on Awe cede, farnse % Lad.eg My pease >» O24 2 Gee ® ®-6) . Abanksha Negi /EL/0F Bl). Differ beheeen DFA e NEA f . BEA - NEA Ay ©) Atards heteandune Finite a) bands fo Men pete n4'7¢ Putomaba Fiatte Automate UN) we conndt we Zeokan empty Arise tpnni ti Gn ty We Lon mae Lb a4 an Empty Atop . tPdenk! 7O~ (ity db not faby to Contact . . Uae iy easy 10 cOrathuck dd) Dead Ateabe may be Leequihed. &) Epsilon move“ ablowel Whose possible 10 efoto paektrs ees dwdead state mt ne Ae Meputheg, (WE parte pan ve IA not allo weel wife i not posible fo Prrfcten er Wil) Rejuine mnere Apace ae b 3 KOnvervieers tL. Convert NFA to SA tMOrKitiN tobe, a. Create RFA Atant siete. 4) Create DFA trardiHon table wy. Crake OFA final Atates 5) Amplify Den 6) Repest aKps 3-5 until mo fotne Alesplification is ponible. Convert pm NEA TODFA Wi, Rejuire Len” APare 1 Lp Atot esl 0 \ L > %e We rtd vo mt “ ~ n % v% fiat Afote. Y x 9 Cutt character) vy Thain teble o€ NEA Noa Lender dng FOr bOn Able 6% DFA in tee Pepe te. On NPA foravove table ah es: GND + fo Gy 1) reac A £]P Abate 0 4 Abachihe WY anid aoe “| Es /o4 =>% Voy VY vo ofr) Hi Me Gort, MM Ho, % MV Yos Vr, sat wore \, Gr mImy | Vetere “est ante 2 TN, Yoo Mr | %Y, NFA % above table 4 Ay ; _~ “8 AI eo, Po) oS GaRy— Fh, Q.12 How poex Goer Kanabbip VOM in Lerical Analysis? Ber Hanolling inveles dletecti and Heperting orHOrs in houdee ede dssing token generation 6) Gnvelia chardeters. character donot heli io Aah eb “uy Mink tiininaited Atuings. 0° @ i G -ppsyramimig Abe. Hot ore net xclegecl puopes br Welle Werte ie < Org to bourke My SM GOs lentifioe > Gdentificn stedtg witha Lege - e. a 1134b [Vy Lemnments net closed — Mulhhine comment wi thot cles) ob ey miter ey fe Comment wy Bugger Of Wht input —exceeals buffer Shp. ; . * : | Ors vias PE pa ele a It aa | Aygmbo! foble ws me Mose Atsuttire Deas by the L len to Atore snfomrali- cubout iclenti fies Q consents Function . vesuiehle ndmes functor , ui Se 5 > “pe er] ane : Menpow oy Type Lrgerrration ;_ brone olale type oF vasuah les, 4g Lfetre T Ator€ memo proldrins of varucbles OY) Ayrmbet Adebum + - cleclotatierr oh Undeclorea f WY gsieh Deteetion Detect multiple . Vasuables \ nadie ; e, Type | Ace i April a | reg yoo} f a ‘ on sa a Aericek Pratyger communicate with Agriox ei Werk togethe in ib’ Hor, fampiin, Been x Arotaggrr HF Lemp nite t) hexicot antlyyr * ap 4t breaks the ceele Pato tokens wiry Each FOken LA pened to Agriox aralyy tr . arehiy pf cheeks 34 te Ae vere OF toRene soubee code : the Ayrton ne flows penne putes eg ak ane, Kevicot cael tok ory tak aR , bo ae > popenater 5 C68 5 separator parton Anil the checks “4 the Atputnce forons ag voria pisigninest ptakemerk

You might also like