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
42 pages
Unit 1 CD
Uploaded by
Pritish Dighore
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 Unit 1 CD For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
17 views
42 pages
Unit 1 CD
Uploaded by
Pritish Dighore
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 Unit 1 CD For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 42
Search
Fullscreen
veep 14 Lana, PROG. /COMPILERS (0.6. VIISEM.C8.67- yy) WINT 3(CT) mm of compiler im bet 2.1, Esplamn anatie-eythesi mod Am POM 2.2, Vaplain with sable examples. the concept of Evalue and rae ofan expresion mM ane Pta7.039 QA. Eyplam with suitable evample, what is bootstrapping mw Am PIKO.0 SUMMER - 14 (Cs) Q.1. Draw and explain general structure of compiler design om Ane P1001 0.2. What are compiler writing tools? Explain how to use these tools in seta 7M Ans PA QU7 SUMMER - 14 (CT) What are the various stages in the process of generation ofthe target °. code from the source code by the compiler? How these stages ate broadly classified? Explain each. mo Ans. Pt-10,Q.12 0.2, Explain the advanages of analysis symthess model of compilation oo Ans PA9.QA11 Qu. Explain the folowing tems (Syntax and semantics. (If) Source code and abject code. EH Ans, P24, 035 (0.2. Explain the ouput flex analsis phase Give the importance of this output in next phases of compiler Ans. PATS. Q09 3. Write notes on LEX Bu Ans, PA-18,027 Tes pry kia QUESTION BANK ene given as por syllabus] SOLVED. Iseau [A compier is computer prasam (or $1 of FOR thy sowms source code ween ina programing ANBAR (I woe het eomputer language (ihe target language fen having ge) int ano as objec code). The most common 3800 Fr wanting hh binary form known to transform soure code i to create an executable PHOBTaM. the mane eompie” i imal asdf pons Ua AMNe UE ol ramming angunge 1 8 fot Bevel LMQMHEE (8. ary level 0 from a language or machine cde) built by combining these very simple ‘A program fora computer rust be tlt by oa machine language. Since thi is ino program in wha is ealled machine noses. Si instead, done wing 2 Wiehe! deus commands and evorqrone process most programming programing langue ‘This language can be very different from the machine language tht the computer can execute, $0 some means of bridging the gap is required ence compiler is very essential ‘Acompileetansates (or compiles) a program written ina high-level programming language that i suitable for human programmers into the low level machine language that is required by computers. During this proces, the compiler wil also attempt to spot and report programmer mistakes. INTRODUCTION TO COMPI Q.1, Whats compiler? Ans. Compiler : +A compiler is @ program that translates a high-level language program into functionally equivalent low-level language program. So, a compiler is basically a ranslator whose source language is the high-level language and the target language is a low-level language. As an important part ofthis translation process, the compiler reports tots user the presence of erors in the source program. Source Compiler Target program iter }K—» Target Error messages Fig. Acompiler eEusp 1 LANG. PROG. / COMPILERS (BE. Vil SEM. C9.67-NU) oe: om proces? Papal tall (OR Define the flowing terme ves . (ora wor I verve tht Wanner moe ngage he ore 9 Token mane OW What do youmean by phaser and phases af compiler? + ramming pune seemed aguante gt gs aa why nese tie a machincarented | A lisse) Ths compton fname conet i he pdton of . (Toten: + Tokens ate symbole names for the nities tat make up the tx + the ink Retneen the (absaet) wosld of appiation ” celopment and the ow-teve world of applica exestion on ‘erregan = + Forexamle ifr the Keyword ‘i, and id for any identifier These makeup the utp ofthe lexis nays. Error messages + Token is a string of one oF more characters hat spicata 2 sroup. The process of forming tokens from an iu seam of Source Target hacer called okenization [—+| Compiler |}. 9 program comer program — Fig {a} Compilation process +A exeme ic» sequence of characters fom the input that match 3 an er eee pate (an ence censite an instance of token. eewnl genes eoaan + For example, if maehes the patrn for i and fool23bar matches J ‘the pateen for id, preprocessor i) Patera +A pater ara tat specifies when a sequence of characters from fous foo the input constitutes token. + Forexample the sequence if forthe token i, and any sequence of cami re the sequence i forthe token if, and any sequence of nhanametic stain with fete forthe token i assembly program i) Phase: +The compiler has to undergo vatous different individual dependent assembler as well as independent stages of compilation these stares of resonatable' iachine exte) processing are called as phases of compilation + When the source language is large and comptes, and high qualty ferkicod edie curput i required, the design may te spit into & mumiber of fclativly independent phases absolute machine code + Having separate phases means development ean be parceled up into Figo) Compliation program flowchart smal pats and given fo diferent people 23. Define he atoning : + Weatio becomes much easier to replace a single phase by an (Tokens i) Lexeme (i Patterns improved one, or 10 insert new phases Iater (eg, adsitional plimizations)16 LANG. PROC. COMPILERS OE SEM yoy QS. State the different types of eranstators, + comingimahe meg hatvetaen campers dnt ine | Ant The diet ps of rao a lo enough memory to contain one program that did all of this work. So compilers () Interpreters scent wae popin whh male parse soe | usa porimming ance ned pa ome representation of st) performing some of the required analysis and intermediate code. ‘noone + eres ze oflen smaller than compiler and tatene + etn cotangent dees en ess Pees tar teatime eee ent Ot eta gg pnt prncaplo i no paneepin ‘+ Many early languages were specifically designed so that they could siete pera fully Sows tan ht of copy compiled object program. sc campiedina singer. Pac © Prpennes fo ent a wking machine ng ppg eee manor (bo we dvaped fo h ten Am Tranter: ruts + | Avmuaor popu tarts seat apcgeenortestson || Sah nigage ots warmed by poser weg mae ‘Programming language and produces output program in another called as assembly language. language. + Programs written to twanslate the assembly language: to mictce «amr nn: igh re pug ch 8 FORTRAN, PLA, | lngmpeisad ements Sone ee oe a elses cantina mere ||feyiime reetts ete tea ener senses Tne: of che age sk np fvasizorb ated] oti onace Cn ead eh rpm: mpi (i) Preprocr + ake progam in one igh ee! ns “+ Executing a program written isa high level programming language translate it into the equivalent another high level language. aan Q.6. Why we need translators? eco on + With the machine language we must communicate directly ¥ Fiat) Compton compe in tems of bis, epee eal coton Oriestprosrm [cred |_,0tiestpooam | «sixes mace ete papa ig ee a (of 0's and I's, programming a complex algorithm in such a ang= Fig 2) Execution ann | rmseuee ogi mest Gatbecopie. iinet be | * The min ntanags of machine impag cfg Oa # bjt program. Then the resulting object program is loaded int ‘operations and operands must be specified in a numeric codes ‘memory and executed. * Sore need a tanstators to modify the machine language OPH ihn ete a.¢, | COMPILERS (B.E. Vil SEM. CS.CT-NU) vBD 7 LANG. PRO Gn Wan W the aieence between a compiler Inguase and | [CROSS CONTE Interpreted language. Give examples of each, When would we ene prefer interpreter over compiler? Ans ® Compiler langue Toterprvied anna Th | Tecan tanguage: Ta this the program fist rogram is fist converted into | converted into some machine code and is then ierprcted code and is then icy executed by CTU. indirectly executed by Interpreter proeram, Gy | Reads he whole programe “Te iercter take one called source code written in} statement hen transtates it and some high evel language and} executes and then takes ransates code ofa progr | another statement. ming language in machine code aso called a8 object code Tar] Comper Tanguage program Tnlerrcted language program execution is fst since dreet__| execution is slower, because of machine code is execute. inet code exceuti Th] Tre compen waneses he | rterpcer stops wana entre program and then afer the frst er. executes it GH | Cake protuced ewok portale | Tiered coe is portable since it produces machine cade | sine interpreter language whichis dependent of machine. | program do not produce machine language program. Tr | Example of source Tanguage | Seripting languages like Java ae C, Pascal, Python, sctipt, ASP, JAVA, et. FORTRAN, LISP ct, Tay | These ae inferior comparedio | These languages are superior interpreted language with to compile language asi teference to program involves testing, debugging evelopment environment. | and editing program which supports program development Th | Wincosticras compared to | Interpretation of program is interpreted program ‘cheaper as compared to evelopment environment. | compiler language. on. on on on Ans. What i cron compiler? Define cross compiler. Write short note on cross comple. Whats the theory and loge behind cross com Cros compiler: “peru compet a compere of crating eveabe cde fra platform ter anh ene on which ibe comp ‘A cro compile ie neesary 16 compile for multiple platform fom ome machin. ‘cons compiler could enene an enceabe for ech f therm fo one Aasialy there exits tree types of languages Source language ie. the application program. “Target language in which machine code i writen “The implementation language in which compile is writen. -There may be a case that ll hese re languages are diferent In uher words there may bea compiler which ren on one machine and produces the get code for another machine. Such a comple is called cross compile, Thus by wing crs compiler techies platform independency can be achieved. Land want to wit cross For example, we have new lagu compile then Sto generate code for machine Nie. we reat LgN Ian existing compiler for S runs on machine M and generate code for M, itis characterized by SM I Ugh ran though SyuM, we ge compiler LyyN ie, compiler fiom Lto.N that runs on M “Tis process is iustrated in folowing Fig. by puting together T iagrams for these compilers. Fig.(a) T diagram with § as source, T as target and as
You might also like
Unit 2 CD
PDF
No ratings yet
Unit 2 CD
88 pages
Question Bank TOC
PDF
No ratings yet
Question Bank TOC
8 pages
T O C Combined
PDF
No ratings yet
T O C Combined
42 pages
TOC Unit 3 Context Free Grammar
PDF
No ratings yet
TOC Unit 3 Context Free Grammar
38 pages
Toc - Unit 4
PDF
No ratings yet
Toc - Unit 4
30 pages
7th Sem Syllabus CSE - Compressed
PDF
No ratings yet
7th Sem Syllabus CSE - Compressed
23 pages
Cse 4 Sem Data Structure and Program Design Summer 2016
PDF
No ratings yet
Cse 4 Sem Data Structure and Program Design Summer 2016
3 pages
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (643)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (298)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4.5/5 (1856)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brene Brown
4/5 (1175)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2289)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (144)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (629)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (244)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4.5/5 (1139)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (836)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (233)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2546)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4.5/5 (4103)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (919)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (903)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M.L. Stedman
4.5/5 (815)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1267)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (943)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (2885)
Little Women
From Everand
Little Women
Louisa May Alcott
4.5/5 (2369)