0% found this document useful (0 votes)
49 views22 pages

CD Unit 1

The document discusses the process of compilation, which involves translating source code from one programming language to another. It outlines various phases of compilation, including lexical, syntax, and semantic analysis, as well as code generation and optimization. Additionally, it highlights the importance of error detection during these phases and the role of intermediate code in the compilation process.

Uploaded by

kmokshada
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)
49 views22 pages

CD Unit 1

The document discusses the process of compilation, which involves translating source code from one programming language to another. It outlines various phases of compilation, including lexical, syntax, and semantic analysis, as well as code generation and optimization. Additionally, it highlights the importance of error detection during these phases and the role of intermediate code in the compilation process.

Uploaded by

kmokshada
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
iit. Satduchos ty Corp 4 froabysis of the courte, =a Ma eagles the geuping | constauchoo tools fy Sirople one. - _conswming s Since J Le compiles ane _avajlabl. this Bess hos ___.at_sophishtaded activity, white! Shading sh 18 necessary fo understand ~whot howd the pilakion proce. ca rie ces ree we will ast with bowie _tontepis!

| astougy- © scanned with OKEN Scanner carembly language [Link] a sed by a” wear called axembler shad peduces colecotan), rchine cocle at ifs opal — | Lnege sore art offen. cempiled “the sclacafable machine Code may have Lhog ether with other ndloratable aby Files the code. hed Saewe UNG ‘ong ao Ailes oto Kink ese stsohyes 5 “eterna et nay _addvate be [whee the cd jn one fle 7a ‘ex. OF veal Lio anther file See eree = | the Jeader then pws _togaher aw of thee eres Jes inte __memony _ der_ ered, I obs _ef compl complet [in analycis : states pangraa—i | ae tee =a cl ering Ee ting iss etined. then a salecanedialet cated fart) the inp sOure® . program, Tn_syrthetis__ part this interrnediahe form ¢f souru eae is of Sone inte an equi volin! > __ phe a & synthens medel Shewn | aa following Figues - =| i compiler + a ~ Tosi fStel | a Te! (oe CTO © scanned with OKEN Scanner ' |_ the coy pa Je caveatadd. oil lolo wtheves | | sub peels Such, a shings ty} Hence, te SAS ee nothy Collechion $f chorackers having ie. Sintey Analy SNS 8 — é = al Pn thie Shep the Sokeng aee asetanged 19 rt hierorchs cal chnuchiee that _altimass g Pe t anal finding the Syabevs np the Soured slang 8+ Seroantic Analyais 3— |__ stn this athe. meaning of Source sloing eo je detec mi ~~ Jd icin all these analynic steps the meaning Sf every Lsource Sheing chow’ bo nigua Hence, AcHons in lexical, “Sinhox § semantic! analysis “asea uniquely dehined fr given Banguage. As we sawed castles the poocess leormpjlation le cavtied out io qo pass i =| Boabisis I 1 Si esis | “again analyis 1s caxtisd out io Hrete Sheps lexical analysis Sporto: analysis e Sermanke any © scanned with OKEN Scanner bis broken: © » Bod Synthesis 1s care ied. out with the help ef | Toleemediate code _genceation _f code _¢: 'mizabie pine OU | A _teken is a Sequenct. ¥ Chatacker hoving collective meaning. Fer @ample, if Some Align ment jatement in a Sousey a) f as lows = - =I ote = count _+ wate * 10+ then Jexical 1 phate this Stedement i. bien sp inks Leica tof lokens os alles 1) The sdeniifier Lebel tole The decranment symbol] C=) 3) The den Hee oun a) The put vgn _ tt) The ichntifies tabe - : 6) the. _rnultipli cation — sin CH) * The constant number . [The blank charackers Which ate used Yn the grarnming stahament awe elie nabed during lexi ceul analyeis. phat cfokern streang = — -_ 1dp + ids, * \o © scanned with OKEN Scanner syntax Aoalysre 3 — 1S ae ae ey ups also called ay pansicg im mines oth. he hg the tokens cfogethen . SeuKee § sthe hieearchical Stuchvec is cated as _guncxated in this ph ale. ete sepalen le me = total is Coun a Tare. \o ee i) i vate tp fics __wote %\O__ pill be _conaidexed because in th asithmnehe expression the. multip\cation operation shail be_pelfoemed belere the! additien, | | Fee building such une. Sf aintex ‘tmes the. + fecustiem ule aee designed. « the ndes ao jase seeped by context Free. Grammet - ae sporession produchion mules axe . ne expression! —> enh her 2) expsession — > number. 2) Stfaucien 7 expression | + expression 4) ex io = Bxpression ) € e session 2 LS) 2 => (epsescina |) By male 1 count & wate axe. sapressivr) b © scanned with OKEN Scanner awe_(2)__ ots also an “ex rd malo ty WE get gabe K 10 Ah expectsi¢n ss : ; repereesiOM . Ltn % aabe Ryo 1S an express! Dn. Vinay) =} D|Semanhe Ana be anes the J -syntar— is__checkel Ais : phate the next phate 8.4 the > -—Semetnt c_ arnalees anal. si5__cletnen Se me ofthe _soutte_stoing - Fer_oxtm pi mRaning F< R Source sting 0 ns__matching af 4 ata : 1_an_espstasion 0 _ matching fess eke statements | or _petfosming aithmel!< operation Lo®_oxpressions —thad ave type compatible or checking the. Stope_6P opeeation 7 | J — T jae a | tote) : | oa count *. : ne wit igh titan iE : 1 18 Ee =| for example, a binge, _aithmette: aperatorr may be plied do cithet a “pai ef -inkegees or by a pa of leatiog = point qum bees Se the operator i applied ae Flowing. pein} number and 20 jntey the _Compi oy convert OF coeEce the. inkeger” f | [alee rel leaking, = point Nenber . = Fee oxample, many pooguamrni ng languages Aehinjtions : _ | xequist.__@n_avetay tins do: an, +The comp 7 iat or If 4 Flooding point numbee is_ —| uted ton index__an_array . © scanned with OKEN Scanner | : | | vthas theee Wace Lanalyays s AVAER ts | | There awe. ceofaio properties which should be. possessed by =the three’ addears code & shore ate 8) Fach =thees _addsess jnsruchao has at the mosh one_operand jn _additing -to -the assignenenl - Lo The. Compiles rush generate. Oo dempoary name sto_hold_-the! value compated by each jqshoucki or. ) Some _~thoee _addwess “insoudoax may have fewer than -thsee opeeands 24. Fest _f Jost instouchiog ch above gia cthsec “addeess — mode. S| ede. sobimivatfon s— =| this phase 5 machine independent pheae = | Code optirnl ation phate. a tempys sto inpa © scanned with OKEN Scanner Abed beter _ ee ahe code «50 ! ode a west TAL hase is__necessed® pred with sesetl = _cThis—p feo ay havea fasted e - co weode -that _consum Pi —— t _algosithen - gta nina fon too that od ome emey ” i aemanlit_¢4 anal ee diaal seine a deh code genezatteo ape. _ie 7 _ gore od \_cfarges code - ophim — coeralt a thar the conversion for j-the che cluce & Finn fa itgobing _poigt Can abe. ina atl ah compile. _ time s0_th can be. eliminaled fo sepsing on intges eS by lore 0" D floating point “number 19-0 st enly “ence =o pala tn da opbionizes, tan__transforn 14 into _shoster, Sequene | + = id & 10-0 | jdt = jdoatty. ~ the signifitant amount af ~time_is _spent_on eh | | chase « | shone aoe simple. phim) zation that sian: Limorve the running Aime of the. 4amgoh pape |woithous towing down compilation “ten oyna a code Geneeatfon 2— + | Sn code genceation pha the. tah code. gel [genesated . the inteemediade code Jngkauchions are [translated _jnto Sequence. of machine jnstwucHone. Mev wae, RI App. Ra, Rf Mu) dr joo , Ry Mev Ry stele Mov count Ro © scanned with OKEN Scanner Ard the etcocd af each date fr satay ee detects tha] 1 th =_syrnbo} dee | } eldercojne, ai | identities & Ahorfoce ho | the cercwicing, phones sf Cat, We APS. Sho fable + jn Yorjuus choses a2 White Deeg sepseod srodtaic — Geranhic colyays ZL vheagyeds ube gener ditog We need do fork ary, During the. iGerenativn abo how. rh hy “i deniihien (x seen lighed © scanned with OKEN Scanner te meq uied_-beseee ig? Whey Symbol table , SOME foro Aphent awe. encounteeee| 10 a eae “ah Fam Necescary As keep the RES ae tracaces of gome token -— os nek. { the. infeed _s abl pes the _ tony viler ta 40 rack a scape 4 ~——_L binding a2 AiHewent _enkitfés a — they ach abe) _|.& used io the. __preqrarn. eh 24. iol 5. pene raed te loa) | GE Tee eld Tin ioe be Symbol Type saps |: Memory | Additonal Nome Location + lagormaking x int | globa)_| O*120 | Deckyrati'on . 4 Aleat | globad ox lou peclqratin : od funthon | gfeoa) | 0%20® Ratype — ink _| gaa fink add OF 300 LSD amneren —-}-+ fot | ad | 7 B0p Patamebee pee. fetal ae © scanned with OKEN Scanner No eros writes by human {3M _exrovs tp ‘hand athe eros ; can beceed the errors gee, yeported in the fe messages > when the iqput characters foo SB _Oe} efermo the tokens the (awical _ | axnolezer clbects Wat eerey, Lew Number of see, AA | BES oan be_detecled ip cpotay analysis phase. | ch _eteor8 ave Populechy called as syntax erdorms | J Si Dusting emantic | analysit stype mismatch kund sf. exons one usually feteched | —_ seexample oP compilation =— — foc ement arbycoeéo , woke atl compilation phases voith iopuy £ curpus to each phate geo the Fig usec on hd uct page. © scanned with OKEN Scanner oust pressing 10 com pl low ae bee RO, ___— snbeniiaaias|! i 7 7 [ [texicat Analyeee J seman oe “ee ide, i, yo flood | co Say © intdostjocd (eo) oly ida 4 ly ctrl! ’ ton fda yt aac : ibs by © scanned with OKEN Scanner (Mov - Teod Ly" ae ophtan dy % 60-0 Ry fa Tye fda y ty nad Mov R RL an Ry va) ing of phares dog ether | end and Back end _Moatel. en Fant end = y |_| Leeticod { Povsges. gornanhic. Analzer Anal 4nee Frteemedicfe cade Backend, code optinn nee. 4 ae} © scanned with OKEN Scanner Rc cose a istagethee — Het awe _-toteutly dependent «poo af compilee can be Different — phases form do nalysis_, syotee— anelyels a Hote ef. __lex al eae ‘end. Eghe- _bai ; ae 7 inclependent_of the _< source Sanguage ou AG |code _geneeation g & code. optimization : the fans end ~Lback Ende wnodel compiles is bp tosch_edeer | ~ qeous _btcatse, of_ following scasons iS 1) Keeping -the same. feat “end © abteching an aaa 4 | | pole ends _, One Can rod ce Compiles er sen} gource _fanguage. differant moachings 5 Keeping aitferent feat enc 4 same book, ~ end co} can. “compile Several different Songuages on tie | soe. machine. P : | cousing asi He doken On Heer die other _ hand Vt iis veey skten +o pote code generat, [aol intermediate peprerentation has been compl | qenetated for examg in_gome languages pe apaWles fo 62 wed before ‘they axe _cledare) | ae canndh genezare the targa coda. fe _@ conging | if we de nok know the types Le wwiables Hevaleed, | 40 thot conshouct | Sy Sem _cases tp eo: ible do leave _@ blan} Leet Gr _missing ietoanatiog £ Fil) jo the Slot Whar abe jofernalion becomes ze vettable quulable. sto poshicular, foheemediaic. aged ode. genetatin | tan Fffen be merged into as Usiag dechnlgs . Called Paaak Dakin gy © scanned with OKEN Scanner

You might also like