Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
17 views
35 pages
CD Unit1
Uploaded by
12 B2 VISHNU PRIYAN M K
AI-enhanced title
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
Download
Save
Save CD unit1 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
17 views
35 pages
CD Unit1
Uploaded by
12 B2 VISHNU PRIYAN M K
AI-enhanced title
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
Carousel Previous
Carousel Next
Download
Save
Save CD unit1 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save CD unit1 For Later
You are on page 1
/ 35
Search
Fullscreen
OBJECTIVES: To leam the various phases of compiter. To lear the various parsing or e4 uu =o UNIT Ii ny eed sara a w 2 Role of Parser — Grammars — Error Handling - grammars - 8 grammar — Top Down Parsing - General Strategies Recursive Descent Parser Predictive Parser-L(1) Parser-Shitt Parser-LR Parser-LR (Ojitem Construction of SLR Parsing Table - Introduction to LALR Parser - Error Handling and Recovery in Syntax Analyzer-Y ACC. UNIT Itt INTERMEDIATE CODE GENERATION 8 Syntax Directed Definitions, Evaluation Orders for Syntax Directed Definitions, intermediate Languages: Syntax Tree. Three Address Code, Types and Declarations, Translation of Expressions, Type Checking. Wear RUN-TIME ENVIRONMENT AND CODE GENERATION Storage Organization, Stack Allocation Space, Access to Novocal Data on the Stack, Heen Management - issues in Code Generation - Design of a simple Code Generator. UNIT V CODE OPTIMIZATION Principat 8 ‘Sources of Optiezation — Peep-hole optimization - DAG- Optimization of Basic Blocks- Global Data Flow Analysis - Etficient Data Flow Algorithm. LIST OF EXPERIMENTS: 1. Develop a lexical analyzer to recognize a few pattems in C. (Ex. identifiers, canstants, comments. » identifiers. 5. Implement simple code optimization techniques (Constant folding, Sizength reduction and transtormation) Implement back-end of the compiler for which the three adcress code is given as input and ‘8086 assembly language code is produced es output. PRACTICALS 30 PERIODS THEORY 45 PERIODS TOTAL: 75 PERIODS | i [ f i i i & t 8 OUTCOMES: On Compietion of the course, the students should be able to: Understand the different phases of compiler. Design a lexical analyzer for a sample language. TE cert Pereiag eigorinens lo develop the parsers for a given grammar. Understand syntax-directed translation and run-time environment. Leam to implement code optimization techniques and a simple code generator, Design and implement a scanner and a parser using LEX and YACC tools.1 a a “nh CS8602 COMPILER DESIGN. | unit1 - dntroduction to Lompilen, 1eroter Trandate Airy 2 Compiler : 2 Intinpyelas | oar 2 Aroteitlylen. Taanstater : | | dounce Toye | Paeqpam Taanslaten Paaeporn * Translator Ue wr pregram wich bales the input 24 Source -peqram Clnpur? dranslale inte uyivnlene tavger rogram Ceutpuk) « ple AU Shamlals one 4omn of Papi tnte jorethen fem of ouput pSource Lanquogey can bem cnlgh lewd Language Ararstate tnte dow duvet Hangers a Machine Auvel Jonguages - Vypes of Trarrtaton : ay Comprterarure. mae) final dainguoge {regrem ‘ 4 donne oh Se Compiler ‘tomunt leigh Lune Danpeage voyer Sito avteelly Jal danguay |i. using eusemble, Sranplater which Ps dnpur as oxuimbly team Snto Lous Jwel anguage A Uackine Lavel Janqunge req. at oct, — toms Leaaety Pacgrcun‘ > Machine Lemel poet language - Assembler. * Assembly Lamel language Progaarn as [koput and conwert Into dew Level danguage Prana Machine level Janguage Paegram suslng wusenbla Translator. Avsnbly dovt dos Lenut ead : ao er Machine fer 1 Bo C= are gage Mov a,R) Mov by Rolode Line by Aine « eg: gave »VB CVesual Rastes ) dource j Tanaet ntenprote | | aly Compt dualyste- Syntherts Medel [ eedeltotp den alae @ a r Se bynalayte Ltiatennt Te | sancti eg |S ee [araiyis- Snteds You). ede Awrabyris pont the ounce pregrom 4s read anc broten coum into Consftutent (neces . + The Junto sand meaning ef ithe ounce sbury Ah vdeermined anc then an Intiamedfate code ts ratticl em ane Input dource rag . Syntnuse " * da Qyntherts pat this Internodiots orn eb: | dource Language Ls daken and Cnwit {nto ar ewkvaunt tanger (ueqrom \ aunty Ads jooous Uy eertath, code has 4s be optindryicd fon ofpicten exvcutfon then whe amtuol oode Ee optlinadped « { cet rhein gp. eeaa dett Tider atic? #7) 0. ° ©) ewe process of lemnpilatton Bs eaonted out 1 | tim-pants , © | M a) dinalysts ® Syntirest “ P bio YK Anabipts phoue dy casual out pans, (1) Laxical dadypls | o) Eyntove aivaigses (3) Semantic 4 win 44 g paw cared oot i Be Bp UD dntuamediale “Cede generation: 2) Code Opti mixptfon (3) bode geroration —) Sournce Paegram po ata1 deetiat Analysts } | | 3 The Lexteat analysts & alo celted Acaneting the Complete dource Code & dvannecl wand your, downer sorognam, Ss Broken wep nko group of. Atairg Ls called dpkers. #A Token U4 A Stqponce chanachine shaxting a (oUrelive wnsanting * eg: 4 dome -eusigoment “tatement in goure (ode, Jalel $= Count 4 2rate & 10 Aokan Tab leer ‘land fisn oe ae tone bbaine P= _y euslgrmente Operator operwker e teunr _, Sdentifiba pe Apecioh ym venquera ay a sae bperaten.i 2) Syntan Amalia nN’ et whe synod Anolis alto ceed pobsing ae Lie toners qervraded. by tot diced Anobupen ana opovrpudd Jogi +0 fown & daterareliced « AlAuctint « Py Ue syntax of dower aning by qponpheg 4 de Anderaneatinl Abs vhun! qo Apncs 2s tau Ayrton Woe oh poe Hie « eg! Totaly: (oun pera #10 k wralor Prediderce ‘ & Produution Rube at ne ies cm x “0 a Cen kame nals lo LPayeT ate fon Total y= fount qrab x10), fy sine note # 10 wilt be tonidorod, because “expaon tee mall Apoutel be qurfernedt befor addin solatifonn epuancion bALt be perfenred cavalys albivmine the Houicees He Artur + ated In theCred ctor Reus : Wwe 3 Adentpin @ E 3 Numben CE 4%, & ox WE 3H + Eo WE (). where E stands ter an expr * By mule O “Count and rake are expmssion . * By ue @ Number to & also an eeprieiione a By mle @ we ob sok x 10 % aio an expresion 4 Uratly Count + sob % 10 i, ale on expausion 3) Semansfe dralyis; f nthe semantic drole determine tre teasing eh te eee ; a eae Ae, oe ea mansTO total a a5, A he, bo ftoak w) Ginter mediate Code-gunatton ¢ al # Eos de quote wh rede and eably wrt tp Aougel ‘Code. a Nontaty of (ue Auch 4, wd addws Code v o> dyuadauple a 3) Aruple CD Postx 4,15 ink 40 pont C10) 4,52 nals # FI fy = count + bo total = §3° og due ensue adds paesonttt of Ansivetion ad ep Coa t ap aoa aa sree a operand iol «fy 1 Yale & 10-00 total i= tount +t- (Uy-odegunination : * Tanger Coole guts qewrated & Srtimediats code Bubtuution Landed trip Beqpaner of Machine ivtuaton » Mov Aate , Ri MuL 10.00, RI Mov Count Ro App Ri, Ra Mov Ro, Total aie daymtrl Taste Managment: ete Puroues af Lonnpilen ay enbel babi 2 Maknragned + To tow Identifdon ued un the epee *& Shon Jingormeaton ahout atbrfouter & Symbol tail & a lock Aouckiine tow | [Fejewmain, abou sae ae K Heol Ae oucorel for cach Identipiin apc seo oi adetoue dara from the accord nly, & Aurtng Compilation Laxftal Analyyet debeck Jdendtine anol make ertiy Sn spent) dees a dexdcal Aalyger vannet detemméne aL the abfloute ch an Ldentigien aml ottsibula ane entoed by temafntng paves eh tomnpiler « Loner detection gra handling + a Program woxitten by furan being cannek emer « "edn, ornyhlation tacks phase deteck OVI, a Reported te ever handler « © any ruber sp ery an, be ence Syntax analysis phase « r & Semantic analysts ape ealimati He of enor Xs dutecled « i eg: Ais bacxbo-a Fy p= fink ko dtoat (ood toi= dds x by3 4 voy Ula e sy . Mut 60.00 ,Ry Mov dla, Ro App Ri, Ro Mov fo, idlMov il2, Ri SUB Rs, Ro Movers Hov Ra, Ld. MuL Rr, Ro Mov fda,Ra ATW aite down He ofp of soc phos for the expruston A= btc -60 pov ida, R) Baers ae e2 Mov 43, Re ADD Ri, Re : Et “1 S08 bose Ra Rae iE Mov Rey dy* paloris , 2 AAA, bs BeLediced Analysis | Lh ectead dnadyser is the fast pheue tf Me Compiler Gate derical dnalyor atad Ue Lepal ‘oine prepa om Jape Ao ainht one Chasaclea of atm, and genrale Uy Auypence 4, Aohenss torent a whale Hixon! whi fas dderiehig Aayoaord torstank , opuraton and some Special Suyenicels» Ye dyntor of Abe Pounce program ean we thee Gapur | bextead “Pana pene Rese f Tange: ong anager | Rear | oy Ue | camper | Ce Haig Arkons Mo22 de poodueo tae stuarn of Aokend okt eliminote Jblank anol comment + lt heyy Backoh ti ine oumbend « ap Repent athe evor an counlined. Qe genwrtig Ae Aokens : Tonens , Patrenn , lexis eS 3 NT Kens : ~ ti ade austrian on) sep ch Input RUMMY ah ops Seen, eguend ONen’ and vpucal Aiymlods « Pattern re a ee of sunles that clesrbbes the detersA Lompflen scan the ovo progiern ang foodice Jeqyance of dntene Ls called Scanner « tA nk Max Uint a, Sint b> { j dexerne et (a>b) Sutuan % 5 he netuin b&b; une< v 4g. barttod Ardlysts + oda nab ond gree arcs ane caxpanabed Yor impljing the ack of ene © Olin phases + Gepanation suduces the talon oy gaalg upnases . | a teri eppictory a a Anolyyr tt acpanated, » sBuetio Teclnbapus or efficent gran tho ounce fle * Toners obiaun an inp Lthe -puifownarce of Corpor» Input Burgedng © = + Gedcoh dnalipgen dean athe wp at spore tye ate oe mda ae 0 Two 3 pnt oy Begin Pointer a 2 torent Pointin (Fe? - ety ea pa te : 4 gti feitrogpd ad GO Wh obs us butles dp increase i ganct t| & Blank space & -ancountenec Sk Sndtaty, a, an of foemes ten ff oSL EEE - BoA ele] ALE LL] fi wie Bele 1 EE ee AN) “fab |) BED TREE ALE GUE PEE Tons FE Tinput bupyrtng] * Ihe fousard pointer encountia a blank pace awe uxeme Jnr 2s Lcbentifisd « | phen Jeriad pets entounter 0 while preg ‘ts Ayo ‘head a ig aaa # Lun bet begin ane aot platen ane et ak next tonen ‘2’, || : 0D OHe bugger Scheme | @) Two bupten Schome « (0 One ne Scheme : a nk Lone i towne ating, Input: sing) a I | diew only one bujjr x wstel Jo stone the [rapa Ag ye 35K 2 we But problem with 44% chee te tak +h “exemes ts very savig tran’ Se cnoies bales boundary 16 sean theiawtrop the lexemeay ‘upper nas to be sefilledl that makes OP) eng ts Bk ao te ere yTwo b eee j peel a pee Las dud anime peo poe I aye 4 l= lh tb the! ee HS Oynd aut IPSN fp. dannd bugger 2 Hipp» ko wipagh dort seel ond of iad (pee cop) Chay?) a oe ae a cag Ryu babe te oo Ne (tp= eat) Chnpue? sob 5 + tominale Loanding *] Epa, oF I Stilt oxmel amass as rl # To, eventome the er ef, cre Buy Sch the Smuthod of hee bapen ane und Le store) vin Lnpur stam tlie and eond pe ane dared alin val, Jwrhen, anol of, .coowent bun i rtached tie etna burger As fulecl . ody te on gh the daamer ie Renger amet &> xe RF chanactin Sinthoducecl at cthe end 2s (altad serdinen avhich 6 usd to Ldertigy the bu» Expressing Tokers by Re Gipresion. Sudifaton of in x The aogulanr exprston we used tn the Apodificatton of “Fokens + & When pattern matched boy dome aagulon exprestin Token tan be sevognlged - S apn erent alphabet Bre iigh ava toed wor hurt piu nga? sagt yo he cpty sng i dan "8 oF a one at Hep ol ing obtafied we| | | | | Ye) Saye af ating ‘ @dSubstring 2 eo demain ig A Abiing obtained by sumoving ‘Zero Cony maar Aymbeh eK: Saving -' " Hindustan” Sufpty Couddl be stan. a stating | » obtairical by Adie o atven Maluge Called Substring. ex: Strting — " Windustan du obing tan be Indy ota Ho en(1) Union of two tngega handly © Sovcatination two danguages 1 and be @) kKtoon closure tn bs ak de 0,04 @) Positive cleune of tus ot amra Wty =f Sek of bags in on : Ly by = { seb of saligs in by fotlowsed ey tk oy Abiing in Lo ent ob anne L* denotes dow 1 Mone toncatenatiion ef Ls ps Lt aay he 0 Lt ldenelaa ‘one Con) mere Concatanaien ai Log Bei Sek of Allphobet- = $A/B6, DZ, orb 2 sek of Aig p= fo, pars aijent — BG U)LUD: a4 arate LuD alan (2. ee Di si, scanslating ef Letters it han xh) sowscs) Lt ae ef sing eet & Grits wee oe ae ne He whieh Aucubed. tees an ‘atl sagan A Regular Bepusiion * Mathemat? ol dyentst Aucstibed by te . O)R= RiUR2 (1). RARo 2 R=R.Ro > ne Stor G)G — Empty igs = FLOR ete goo Q * Tew ove Vartous supa of token, id ok Of dant, Bide 5 43 PAuyroora oaa) Token Type ©) Token Value - Btn Ruane Tokens esToken Value peop ede Tons: Tein Value 21 codec ‘otto ges a Ledeal analyss uy Table Su rvofintoined « Toxo Value ~~ ee ae a one of Hhanitn ond conutant« x hoxical Bnaly cer seal, the tee Be Aumbel bolle or Tokens - Fan a Code vale “4 ' = oe 3 S Geo ggg hs 2) Pe s me. es Leeann ey Coin’n) Ae- ened steg) ; = {Coma Ct A Roaetin to _syenooh tabel Pointer to Ayrnioel babel 4Program Code : (a 210) ae 14) (82), (5)1079, 10, (S110, acai i753, ogy, 25 (5071) \, C81) 7 6511009, (4119, (4,105) é sayy OPP D1, nas ab teglsiet) , nao) Ceo) SnustanadNo * We wean Ue Input aseageige OA “dante And starch the symbetstable to check, whether Br acre asic dy not Sr travir Lnfowneriion about this Tdervespis Jn Aymnbel tale and aeluar 100 « ae Sh the gains Sdentipés, or variable 4s already pruiont fn duro Aalte than fedsol daly ya docs vot Inunt- nto the table Sndtnd it aon the Aecation shone Lb 4 present - ) A? Lex: ; b Nastous Toot snavue been Anite gor Aenstnecing Leeal dnolyzen tudng spacial punrpere notation old Regular Ex preston « ele Regulon Expresion ane Une tn Recognising tthe dokens + omnes at plex Le a Tort aadgin, boreal SOE « athe Len squcgtntin fle Gan Ue Oeof tokens : Tel tex} ; [oemaarion of 2 Srrabyjzen Wing ae Rif, LEX : 0) Recogniyng, Word ui ) Declanation section (2) Rule wectimr x ' h GB dune’ sellers dasT p. hilasas, Shen ptruckune of ee: ny 0 & Sd Kats > atop. AVIRA Soa ga, Aad ahee Aeclarations section : The declaration he Regular dutinition Aa kawhoadly ne mf Regan Bpredion appearing, in te guste section» of stale san a dere:ef LEX Paagrarn : yg ay hae : "Ramo" | = } cnc “Seeta” | “Cota” | : aed | r “Nata” | Patni{(" th Moun") 5 q : 4 ‘of, ty > - von ances | z “eats” | Paintf ("jn Verb")s ; thy ; q main () by YyMares 5 |) Atank tine acrinleg posters ¢y de mule | giver fe bord ool ta drs desiivion sf nein apse due Adirfifon of vend gL tind sion Lemiiae o huon don oO Main ectton @ yunep wn Yen ¢ Us qunaion stant the goanriing a ve regan « apna O : we; yysnap ¢9 reman © grannen Konlinies ay e pein means ae % fue Bi “encountered. + - dt on in Requllan Fp : mearting - at exmany num nos hd [evmany rey a tharacles lous Which(2) Ecno: 4 4b onic: the opt oa a (3 YVTEXT: “* a When fern maths 6% aslo a 7 lyeken from the anpur Ken brent benerne ds “yaned fn Nat owrbnat td srlng calle YT denise, Automate ° ype 9 pets corn pa NFA and DFA aa NFA pacblerns ee nen obi tein, aout & nen vétn G te OM " Lenvat Raguler by Zen to fle ise va Shoe Mathod + Meniniaatin of DFM |G edaire am i wel Doanosd.g
You might also like
Compiler Design
PDF
No ratings yet
Compiler Design
14 pages
Full Note
PDF
No ratings yet
Full Note
45 pages
CD 3 Units
PDF
No ratings yet
CD 3 Units
42 pages
Unit 1 Part 2
PDF
No ratings yet
Unit 1 Part 2
6 pages
Unit 1st Compiler Desigen
PDF
No ratings yet
Unit 1st Compiler Desigen
32 pages
Cyber Security Technical Seminar Report
PDF
No ratings yet
Cyber Security Technical Seminar Report
42 pages
Adobe Scan Sep 06, 2024
PDF
No ratings yet
Adobe Scan Sep 06, 2024
30 pages
CD Notes
PDF
No ratings yet
CD Notes
57 pages
Compiler Design Unit 1 and Unit 2 According To Jntuh Syllabus
PDF
No ratings yet
Compiler Design Unit 1 and Unit 2 According To Jntuh Syllabus
47 pages
SPCC Basic
PDF
No ratings yet
SPCC Basic
29 pages
CD Unit 1
PDF
No ratings yet
CD Unit 1
24 pages
CD ShortNotes
PDF
No ratings yet
CD ShortNotes
15 pages
Unit 1
PDF
No ratings yet
Unit 1
19 pages
Computer
PDF
No ratings yet
Computer
58 pages
Compiler Lab Record
PDF
No ratings yet
Compiler Lab Record
30 pages
Compiler Design Unit 1 Notes
PDF
No ratings yet
Compiler Design Unit 1 Notes
49 pages
CD Two Marks
PDF
No ratings yet
CD Two Marks
17 pages
Complete Compiler Design Notes
PDF
No ratings yet
Complete Compiler Design Notes
77 pages
Compiler 1
PDF
No ratings yet
Compiler 1
13 pages
1st Unit PPL Notes
PDF
No ratings yet
1st Unit PPL Notes
10 pages
OOP Assignment 1
PDF
No ratings yet
OOP Assignment 1
14 pages
Compiler Bipin
PDF
No ratings yet
Compiler Bipin
94 pages
PCC Assignment 1
PDF
No ratings yet
PCC Assignment 1
10 pages
Java Unit4
PDF
No ratings yet
Java Unit4
26 pages
CD Unit 1-1
PDF
No ratings yet
CD Unit 1-1
23 pages
CD Mid1 Answers
PDF
No ratings yet
CD Mid1 Answers
18 pages
Compil 12
PDF
No ratings yet
Compil 12
52 pages
Ilovepdf Merged
PDF
No ratings yet
Ilovepdf Merged
66 pages
Null 1
PDF
No ratings yet
Null 1
24 pages
Python Assignment 2 Answers
PDF
No ratings yet
Python Assignment 2 Answers
17 pages
Unit 1
PDF
No ratings yet
Unit 1
14 pages
CD Notes Unit-1
PDF
No ratings yet
CD Notes Unit-1
26 pages
OOSD Unit-4 Notes
PDF
No ratings yet
OOSD Unit-4 Notes
18 pages
CD Unit 5 Hand Written Aktu
PDF
No ratings yet
CD Unit 5 Hand Written Aktu
12 pages
Compiler End Sem
PDF
No ratings yet
Compiler End Sem
8 pages
CTP Unit - 1
PDF
No ratings yet
CTP Unit - 1
18 pages
IARE CD Lecture Notes
PDF
No ratings yet
IARE CD Lecture Notes
98 pages
Frazana N SYSTEM SOFTWARE 18CS61
PDF
No ratings yet
Frazana N SYSTEM SOFTWARE 18CS61
36 pages
Compiler Assignment 1
PDF
No ratings yet
Compiler Assignment 1
13 pages
Python Unit 1 Complete Notes
PDF
No ratings yet
Python Unit 1 Complete Notes
46 pages
Unit 1
PDF
No ratings yet
Unit 1
19 pages
CD Notes
PDF
No ratings yet
CD Notes
20 pages
CD Unit 1
PDF
No ratings yet
CD Unit 1
23 pages
C Programming Written Notes 1 Pages 1
PDF
No ratings yet
C Programming Written Notes 1 Pages 1
100 pages
CS1603 Class Notes
PDF
No ratings yet
CS1603 Class Notes
65 pages
C Programming Language
PDF
No ratings yet
C Programming Language
55 pages
Computer Notes (Complete)
PDF
No ratings yet
Computer Notes (Complete)
128 pages
Compiler Designing Assignment
PDF
No ratings yet
Compiler Designing Assignment
13 pages
Compiler Design
PDF
No ratings yet
Compiler Design
27 pages
PCPF ?
PDF
No ratings yet
PCPF ?
35 pages
C Language 1
PDF
No ratings yet
C Language 1
15 pages
18CS61 Model 1
PDF
No ratings yet
18CS61 Model 1
36 pages
New Doc 10-11-2023 22.03
PDF
No ratings yet
New Doc 10-11-2023 22.03
13 pages
2Nd Chapt Fybcs - 10 - 07 - 2022 New Doc 10-07-2022 14.06
PDF
No ratings yet
2Nd Chapt Fybcs - 10 - 07 - 2022 New Doc 10-07-2022 14.06
11 pages
Python 2022
PDF
No ratings yet
Python 2022
12 pages
Tranlsation Software
PDF
No ratings yet
Tranlsation Software
15 pages
Semester 7 - CD Imp Notes
PDF
No ratings yet
Semester 7 - CD Imp Notes
31 pages
Compiler Design Unit 1
PDF
No ratings yet
Compiler Design Unit 1
8 pages
18CS752-Python 4
PDF
No ratings yet
18CS752-Python 4
16 pages