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)
12 views
16 pages
1st Unit CD
Compiler design unit 2
Uploaded by
honeysinghjarwal
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 1st unit cd For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
12 views
16 pages
1st Unit CD
Compiler design unit 2
Uploaded by
honeysinghjarwal
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 1st unit cd For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save 1st unit cd For Later
You are on page 1
/ 16
Search
Fullscreen
a 1 Balering: Basically, there coome ae is useful when look-whe- necessary to identify tokens, Buffer Pairs : For many sour times when the lexical analyzer 1 can be announced. A specin)i re! been developed oredr he = Yoprocess an input hw Transition Diagrams construction of AS an intermediate a lexical analyzer, we fige flowchart, called a “transition diagram,” actions that take place when a lexical analya i" by the parser to get the next token hal st check each time we move not moved off one half then we must reload the other QI Construct NFA to ‘accept a (a/b) SEE pa of code optimization? ea Ans. Code Optimization Thecoae Starting state Final state attempts to ii Tunning-machine code Total No. of state = improve the intermediate code, so tats Will result a + ©+6+.@ Q2 What do you mean by Preprocessor? Ans, Preprocessor tA ‘Source into modules, Stored fice Zi the Structure on th structure, Lea 6" Mustrate the ‘ranslation of the follt® Statement on all phase of compiler 4: =2FCt IRV, 20189n take place as described below B*C+ DE Freplain the following terms o Tramstators, Compiters aad taterpreters ere. 00, sonny or Differentiate between compiter and interpreter (R 2003, 2008 200m (1) Bootstrapping (RT, 2074, 2002, 2000, 00m ———SEEs Ans(i) Difference Between Tram jetween Translator, © a and Interpreter nee Translator: A translator is « program that takes input as a program written in one programming language and converts it in output program of other programming, language. Compiler : Compilers are the translators whieh translate a program written in high level language likeC*, FORTRAN, COBOL, PASCAL into machine code for ae: architecture. The generated code can be ‘many times against different data each time. t= beam Objet Poem ae so in this sense compiler, compile the whole program: at atime. Interpreter : An interpreter reads an soot tten in high level pro: for this program and against the data to produce some results. Go we can say that interpreter compiles the — program line to Vine and an interpreter is generally Than a compiler because it processes and inert cach, statement in a program as many times as the number the evaluation of this statement, + Difference between ed Tis output 0 form of Beas ves ‘more amount of [Toca i) Bootstrapping + A ful o of software, rather sireat 3 and soon, that Is Sul ASSEMBLER nblor for subset | of ‘de, perhaps on a lond-and jin ASSEMBLER and ther very little other than convert One might then write nary form ‘of ASSEMBLER in subset 1 of a by which a simple mplicated program, more complicated “bootstrapping”, b (eee computing, bootstrapping (from an old expression Jfup by one's bootstraps”) is a technique by Giies Fig. ott en CRORE Sy Ain tree is usually the result dak of propams. inthe Wartup process .| Phase off compiled. cfieet ae oe feconps.s-gstem, @ small program (such as BIOS) | Tepresentation of the program aan ‘etalon andes theta basic requirement of hardware, | the compiler requires, and has a strong ji esieeneralmenoy devi ae comeced) | fal ouput of the compiler t ttielaase rogram from on of them and passes control The following thing i Sento losding of larger programs suchas | designing a tree for iy pee toes a set oem), diferent use of the term (a) Variables types must be oe pee compiler to compile itself, by first location of each di laration is = put of compiler of a new programmin, (b)’ The order of ect Somes sng nguageacompile more pro 1g order of executable aodere onthe 06 language, This usality dilemma, be stored and Ocean @ Identifiers and cee 3 for assignment statemente woes!A, Astate sy that is distin S. Asetofatstes ¢'= aity t sates. owing the edge Inbeted ‘nd 3 vin ede lla ‘MS, an be represented by © seque transitions called moves. The following deat tf the moves made in accepting the input striag aa c 0 9-8) _byy by . se In general, more than one sequence op Constrection of NFA recognizes th a fom Nr Myesetof states | lend to an accepting state. Notice ther 20% Fae need is shown in fig. Several s s may be made on the
take are of input buffering: PR" hes back input characters By calling the OW ~ tad ungete, respectively. With ¢ a “tthe pair of statements hase <= getchar() = ungete Costin) Wt he stented input tain In Pascal, the snsneiation deolarat wanes ation; in C, NUM ean npr fr using define-satement, "ae stand foe 286 fHdetine NUM 256 The function texan lexan returns NUM when a sequence of digits is seen in the input sath abe be oe ae lowed imme en assigned the anid iC —— Allowing numbers change nthe granmarin Fig We ele ou a digits by the non-terminal factor and introduce the following productions and semantic actions : factor > ( expr ) | num { print (aum.value) }{ ‘The C code for factor in Fig, isa direct implementation of the productions above. ‘When lookahead equals NUM, the value of attribute num.value is given by the global variable tokenval. The action of printing this value isdone by the standard library function ‘printf. The first argument of printf is a string, ‘between double quotes specifying th= format to be used for printing the remaining ‘Where Yd appears inthe string, the decimal represen of the next argument is printed. Thus, the printf statement jn code given below printsa blank followed by the decal representation of tokenval followed by another blank. The Crrode for factor when operands can be numbers i= factor( ) if (lookahead =="(°) 4 Paw ie Coreen (veer sa } we tse if (lookahead == NUM) (NUM: else if ( id patel printf * 5 else error () +ea | Seo | @eeo | i Ge 0 @ad Ge Gu ead Gu ee D Geo Gee Ww analyzer generator. sack st the Lex Compiler to produce the lexical analyser Sen ssi expression based specification. I this came ame Eenerator provides routines for reading and baterng the input. ‘Write the lexical analyzer in conventions systems: programming language. sing the VO facilites of ta language to read the input Write the lexical analyzer in assembly language sn ‘explicitly manage the reading of mpet The three choices are listed im onder to increasing difficulty for the implementor. Unifornanately the harder to implement approaches often . Since the lexical analyzer shown in Snone disk DICK,
You might also like
CD Decode
PDF
100% (2)
CD Decode
169 pages
Compiler Construction
PDF
No ratings yet
Compiler Construction
35 pages
Compiler Desining Complete Notes
PDF
No ratings yet
Compiler Desining Complete Notes
175 pages
CD
PDF
No ratings yet
CD
238 pages
Compiler Design Mod 1
PDF
No ratings yet
Compiler Design Mod 1
75 pages
SCSA1604
PDF
No ratings yet
SCSA1604
133 pages
5-6-Compiler Structure, Phases and Passes, Bootstrapping
PDF
No ratings yet
5-6-Compiler Structure, Phases and Passes, Bootstrapping
50 pages
Overview of Compiler
PDF
No ratings yet
Overview of Compiler
56 pages
Compiler Book Note
PDF
No ratings yet
Compiler Book Note
68 pages
Chapter 1
PDF
No ratings yet
Chapter 1
43 pages
Compiler Construction: Instructor: Aunsia Khan
PDF
No ratings yet
Compiler Construction: Instructor: Aunsia Khan
35 pages
UNIT-I Compiler Design - SCS1303: School of Computing Department of Computer Science and Engineering
PDF
No ratings yet
UNIT-I Compiler Design - SCS1303: School of Computing Department of Computer Science and Engineering
27 pages
CD Important Questions With Answers
PDF
No ratings yet
CD Important Questions With Answers
34 pages
Compiler Theory: 001 - Introduction and Course Outline
PDF
No ratings yet
Compiler Theory: 001 - Introduction and Course Outline
33 pages
Dakshina Ranjan Kisku Associate Professor Department of Computer Science and Engineering National Institute of Technology Durgapur
PDF
No ratings yet
Dakshina Ranjan Kisku Associate Professor Department of Computer Science and Engineering National Institute of Technology Durgapur
31 pages
SCS13033
PDF
No ratings yet
SCS13033
121 pages
Unit 1
PDF
No ratings yet
Unit 1
29 pages
Unit 1
PDF
No ratings yet
Unit 1
37 pages
Mini Compiler: Submitted By: Tejash Niroula 16bce2292
PDF
No ratings yet
Mini Compiler: Submitted By: Tejash Niroula 16bce2292
14 pages
Compiler Design - YesDee
PDF
No ratings yet
Compiler Design - YesDee
427 pages
Unit 1
PDF
No ratings yet
Unit 1
29 pages
CD Unit I Part I Introduction
PDF
No ratings yet
CD Unit I Part I Introduction
67 pages
CC 1
PDF
No ratings yet
CC 1
41 pages
Compiler Design Slide Chapter 1-6
PDF
No ratings yet
Compiler Design Slide Chapter 1-6
250 pages
Compiler Assignment
PDF
No ratings yet
Compiler Assignment
6 pages
III Year-V Semester: B.Tech. Computer Science and Engineering 5CS4-02: Compiler Design UNIT-1
PDF
100% (1)
III Year-V Semester: B.Tech. Computer Science and Engineering 5CS4-02: Compiler Design UNIT-1
11 pages
Unit-1 PCD
PDF
No ratings yet
Unit-1 PCD
28 pages
Introduction To Compilers - Analysis of The Source Program - Phases of A Compiler Phases of Compiler
PDF
No ratings yet
Introduction To Compilers - Analysis of The Source Program - Phases of A Compiler Phases of Compiler
25 pages
1st Unit Itc
PDF
No ratings yet
1st Unit Itc
12 pages
5th Unit Itc
PDF
No ratings yet
5th Unit Itc
8 pages
Language Processing System:-: Compiler
PDF
No ratings yet
Language Processing System:-: Compiler
6 pages
Lecture 1,2 Introduction
PDF
No ratings yet
Lecture 1,2 Introduction
40 pages
Chapter One-Introduction
PDF
No ratings yet
Chapter One-Introduction
6 pages
Unit 1 Slides
PDF
No ratings yet
Unit 1 Slides
49 pages
1.Q and A Compiler Design
PDF
No ratings yet
1.Q and A Compiler Design
20 pages
3rd Unit Itc
PDF
No ratings yet
3rd Unit Itc
16 pages
Imp CS1352 APR08
PDF
No ratings yet
Imp CS1352 APR08
15 pages
Compiler Construction - 01
PDF
No ratings yet
Compiler Construction - 01
57 pages
2nd Unit CD
PDF
No ratings yet
2nd Unit CD
14 pages
CD - 1
PDF
No ratings yet
CD - 1
22 pages
Lec#1
PDF
No ratings yet
Lec#1
36 pages
Compiler Design
PDF
100% (2)
Compiler Design
52 pages
Unit 3
PDF
No ratings yet
Unit 3
43 pages
Atc Important
PDF
No ratings yet
Atc Important
7 pages
Lec 2
PDF
No ratings yet
Lec 2
21 pages
AT - Module6 - Compiler and Its Phases - PS
PDF
No ratings yet
AT - Module6 - Compiler and Its Phases - PS
32 pages
CC Assignment
PDF
No ratings yet
CC Assignment
6 pages
CS3501 CD Qb-Unit 1
PDF
No ratings yet
CS3501 CD Qb-Unit 1
6 pages
Compiler Design Unit 1
PDF
No ratings yet
Compiler Design Unit 1
30 pages
Compiler Design Note
PDF
No ratings yet
Compiler Design Note
313 pages
Media
PDF
No ratings yet
Media
2 pages
CSC 415
PDF
No ratings yet
CSC 415
52 pages
Compiler Lec-One
PDF
No ratings yet
Compiler Lec-One
46 pages
Compiler Design - 2-Mark and 16-Mark Answers
PDF
No ratings yet
Compiler Design - 2-Mark and 16-Mark Answers
19 pages
CD Unit 1
PDF
No ratings yet
CD Unit 1
63 pages
Compiler Design Study Material Unit 1
PDF
No ratings yet
Compiler Design Study Material Unit 1
26 pages
Unit 1 Part 3 - Compiler
PDF
No ratings yet
Unit 1 Part 3 - Compiler
45 pages
Document From Aditya Tripathi
PDF
No ratings yet
Document From Aditya Tripathi
5 pages
Introduction To Compiler Design
PDF
No ratings yet
Introduction To Compiler Design
12 pages
Unit 1,2
PDF
No ratings yet
Unit 1,2
33 pages
Cdbookquestion
PDF
No ratings yet
Cdbookquestion
11 pages
Demonstrate The Phases of A Compiler With Example
PDF
No ratings yet
Demonstrate The Phases of A Compiler With Example
16 pages
Ecs 603ut Sol
PDF
No ratings yet
Ecs 603ut Sol
32 pages