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)
103 views
Compiler Gold
utu gold compiler
Uploaded by
harsh shivam
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 now
Download
Save compiler-gold For Later
Download
Save
Save compiler-gold For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
103 views
Compiler Gold
utu gold compiler
Uploaded by
harsh shivam
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 now
Download
Save compiler-gold For Later
Carousel Previous
Carousel Next
Save
Save compiler-gold For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 46
Search
Fullscreen
Fe INTRODUCTION TO COMPILING AND LEXICAL ANALYSIS, ‘SYNTAXANALYSISAND SYNTAX DIRECTED TRANSLATION TYPE CHECKING AND RUN TIME ENVIRONMENT CODE GENERATION CODE OPTIMIZATION PREVIOUS YEAR QUESTION PAPERS ‘Q4. Define eompil (UTU 2012, 20 age (target language) and the compiler reports to its user the presence of errors in the source yas of compiler? Debugging or Q3. What are the phases of compiler? (UTU 2012, 2013, 2014, 2015, 2016) Lexical analyzer Fig, Phases of a compiler INTRODUCTION TO COMPILING AND LEXICAL ANALYSIS Symbol table manager. Error Handler. Q.4. Define preprocessor and what are the functions of preprocessor? ‘Ans. Preprocessor produc (Ge) the program wi “They may perform the following functions: (D Macro processing inclusion I preprocessor Language extension’ the analysts-synthesis model of input tothe compilers Ans. ‘program into intermediate representation ofthe source program. ‘The synthesis part constructs the desired target program from the intermediate representation. Q.6. What is front-end and back-end of the compiler? ‘Ans, Often the phases of a compiler are collected {nto a front-end and back-end. Front-end consists ‘of those phases that depend prim program and largely independent of the target machine. Back-end consists of those phases that depend on the target machi generally those port source language, just the intermedi part breaks up the source tuent pieces and creates an symbal table operations. Scanned with CamScannerHET] copter Desen 7. Dene Passes San plementation of compiles, portion creee ne rasesare combined nos module cer pass eas he source pogem oF SUSLEnS ante previous pass, makes the 1 oration pele ty ts phases and writes cure ito ate es whichis read by subsequent pass. ‘source program is read from I ‘grouped into tokens thatare sequence of characters having a collective meaning. Q9. Name minimum 4 compiler construction toa? (Nov/Dee-16) + LEX ~ Scanner generator + YACC-Parser generator ed translation scheme. + Automatic code generator + Dataflow engines the two parts of a compilation? up the source nt pieces and representation of (0.12. Whats meant by lexis ana Ans. It reads the characters in the = (i) Compiler efficiency is improve specialized buffering techniges input chaste and pee tokens and sipicanly specs performance of a cor item 4. Define patternviexeme/tokens? ‘Ans. set of strings inthe input for which the same token is produced as output. This set of strings described by a rule called pattern associated with the token. A lexemeis a sequence of characters ismatched bythe pattern fo ‘Token isa sequence of character that can be treated asa single logical er QS. What are the implem analyzer? Ans. (2) Usea lexical analyzer generator, such 8 Lex compiler, to produce the lexical analyzer from a regular expression based specification, (b) Write the lexical analyzer in onventional systems: language using the UO language to read the input (©) Write the lexical analyzer in assembly language and ex manage the reading of input. tations of lexical tnsyoduction to Compiling and Lenial Ars ive the error recovery strategies in fanguage tran’ interpreter, where sourcecode isassoci foits declaration orappearance inthe souree, such ‘ype scope level and sometimes is leation. xe the models of LEX compiler? dlstanee, forward pointer mi more than the length of buffer. 0.21. What do you mean by Input buffering in i ffering technique is the input scanned, hence buffering tecnigue& ae se ock of datas first read into abuses and then scanned by lenial analyze ‘you mean by analysis and jon of the source structs the desired represen the analysis of source program is analysis consists of three the stream of g upthe source program ight and grouped into re sequences of characters jive meaning. checks ae pet components of @ program fit together ‘meaningfully. sn iyzer scans the input fom eft = fim Iusestwo pointers begin and forward to keep track ofthe pointer of Fig. Alanguage processing system Scanned with CamScannerBET conte dein RSs the process of ut. Explain fn smote = (UTU 2012, 201 M14, 2015, 2016) : out au he onion proses 2 tei (hare ah pes pt om ee steers of Te Hee feds ineuprtote cepa of Sova er Lt unded he pin o ome ‘The first phase of scanner ‘works asa textseanner. This phase sans the source code asa stream of characters and convert it into ‘meaningful lexemes. Lexical analyzer represents these lexemes in the form of tokens a: kena, spn peas tiene (gnats ais pa en cone wechecheagunt tes ‘grammar, Le. ck = Senunirassc eter spatescontned alone tlt Fr uae asigaenreh ee Setvin conalda pet an adi se HA, Soman wae Identifiers, their types and exp ‘whether identifies are declared before we Use ong BAM, mediate Code Gene! analysis the compile removes unnevessary code lines, and arranges hg sequence of statements in order to speed up te program execution without wasting resource, (CPU, mem tuctions of machine code performs the ask =x mediate code would do. input from It uses fwo pointers begin ptitop) and forward ptr fp) to keep track of the pointer ofthe input scanned. nal conigurson troduction o Comping and Lexis Analysis (Ea ‘The forward pir moves 1d of lexeme. As soon as the blank space is bes of lexeme. In above ‘The input cheracter secondary st secondary technique buffer, and then second by lexical analyzer. There are two methods used inthis Scheme, and Two Buffer explained as under: is costly hence buffering ad, A block of data is firs read into rest ofthe lexeme the bufferhaso be refilled, that makes overvriting the first of lexeme. Caer nned buffer and second buffer are sc3 When end of current buffer is reached th isthatif length of the lexeme is lon ofthe buffer then scanning input eannot be seam are pointing the then the fp moves sly end of second buff recognized by the end of buffer mark pre the end of second buffer. When fp encounters fone can recognize end of first 1g up second buffers started. “wo bur scheme storing ‘puting Q.3. Explain how we can create or design Lexical analyzer. (UTU 2018) ‘Ans. There are two ways for designing a lexical Scanned with CamScannerBD] conpiter Design (@ Recognize the tokens by a constructed Finite Automata. Whereas Lexical analyzer programmer will do steps, remaining Bre done by lexical analyzer ge ‘which allows one to specify @ specifying regular expressions to describe patter for tokens. “The input forthe lex program which is written in lex language will lex language. A Compile through lex compiler and produce Code called ley always, Lexsrecteaton te lexyre = texcompier Tiiesealanataer program Now, Ccodeis compiled by C compiler end, produce a file called a.out as always i, aout Tenuate rgram) ‘The C compiler output is a working lexical ‘analyzer that can take a stream of input character and produce a stream of token i.e. Sint Ga} ar ceempier exyye—e} — SS ‘aa ‘The declaration seetion includ lesen st constant (LT, ‘and regular definitions. . bLechg ‘The genera form of transition rte ig patiern{Aetion} where pattem is a regular expression {defines what action should take when with pattern. my ftom no fe can be compiled separately and loaded wi exical analyzer. ‘ie (Q44 State any two reasons a5 to why phase, compiler should be grouped? < ing reduces the complexity process and also when te progans for testing, the tester can easily under 1e phases of compilation through a sagt “The lexical analyzer breaks syns ies of tokens, by removing any while ‘or comments in the source code. 2. Ifthe lexical analyzer finds token inva itgenerates ag error, Itreads character streacrs [tt the source code, checks for legal tokens, ann pas the data othe syntax analyzer when it emsols aye —+[ Came St ~(a7} see ser Fig, Generation of lexical analyzer using lex of Lex Program: A Lex program ir me keywords language, key rs, strings, numbers, P= mum contains the tokens: int (Keyword), value (ide (operator), 100 (constant) and ; (symbol). Lexeme [armel Symbols [Pancication| = Equal_OP ‘Mult oP ‘Comma ¢ Left area Specifications of Tokens: Let us understand ‘now the language theory undertakes the following tems: 1. Alphabets 2. Strings 5. Special symbols 4, Language ‘5, Longest match role valid tokens of a language 9. Finite automata 1. Alphabets: Any finite set of symbols isa set of binary alphabets, ADBCD.EF} isastt language te sequence of alphabets yypical high-level ying symbols ‘A language fs considered a5 ‘over some finite set of analyze jeter by leterand when itencounters a whitespace, operator symbol or special symbols itdecides that ‘a word is completed. 6. Operations: The various operations om languages are 1. Union of so Tanguages Land M is written as, LUM= (s/sisinLorsisin of language L. 4. Notations: [frand sare regular expressions and Ls), then 8. Representing val ofa language in regular expression: If is regular expression then: ‘xt means zero of mre occurrence ofS + xt means one oF more occurtence of X Scanned with CamScanner
You might also like
1 Lexial Analysis
PDF
No ratings yet
1 Lexial Analysis
24 pages
CD Unit 1
PDF
No ratings yet
CD Unit 1
35 pages
cd-2m-final
PDF
No ratings yet
cd-2m-final
30 pages
compiler design unit 1 srm 21 regulation
PDF
No ratings yet
compiler design unit 1 srm 21 regulation
193 pages
Code:: Compiler Design (3170701) 190090107055
PDF
No ratings yet
Code:: Compiler Design (3170701) 190090107055
76 pages
V - Cse - CS3501 - CD - QB - Unit 1
PDF
No ratings yet
V - Cse - CS3501 - CD - QB - Unit 1
5 pages
An Analysis of Compiler Design in Context of Lexical Analyzer
PDF
No ratings yet
An Analysis of Compiler Design in Context of Lexical Analyzer
5 pages
1 Principles of Compiler Design
PDF
No ratings yet
1 Principles of Compiler Design
89 pages
Compiler Design Question Bank-UNIT 1
PDF
No ratings yet
Compiler Design Question Bank-UNIT 1
12 pages
cd UNIT-1
PDF
No ratings yet
cd UNIT-1
60 pages
CS3501 CD QB-UNIT 1
PDF
No ratings yet
CS3501 CD QB-UNIT 1
6 pages
Chapter 2 Lexical Analysis (Scanning) Edited
PDF
No ratings yet
Chapter 2 Lexical Analysis (Scanning) Edited
46 pages
CS3501 Compiler Design
PDF
No ratings yet
CS3501 Compiler Design
31 pages
CD Unit 1
PDF
No ratings yet
CD Unit 1
17 pages
L2 Lexical Analysis
PDF
No ratings yet
L2 Lexical Analysis
59 pages
12 Mark Questions With Answer-1
PDF
No ratings yet
12 Mark Questions With Answer-1
21 pages
Compiler Design Question Bank-UNIT 1
PDF
No ratings yet
Compiler Design Question Bank-UNIT 1
12 pages
Unit - 1 University Questions
PDF
No ratings yet
Unit - 1 University Questions
12 pages
CD Important Questions
PDF
No ratings yet
CD Important Questions
44 pages
CD QB
PDF
No ratings yet
CD QB
27 pages
Compiler Construction CS-4207: Lecture 4-5 Instructor Name: Atif Ishaq
PDF
100% (1)
Compiler Construction CS-4207: Lecture 4-5 Instructor Name: Atif Ishaq
37 pages
CAT Short Key Material
PDF
No ratings yet
CAT Short Key Material
38 pages
Lexical Analyzer (Compiler Contruction)
PDF
100% (1)
Lexical Analyzer (Compiler Contruction)
6 pages
Unit 1
PDF
No ratings yet
Unit 1
24 pages
Compiler 2
PDF
No ratings yet
Compiler 2
5 pages
Notes - IAE-1-CD
PDF
No ratings yet
Notes - IAE-1-CD
14 pages
Lab
PDF
0% (1)
Lab
32 pages
VMKV Engineering College Department of Computer Science & Engineering Principles of Compiler Design Unit I Part-A
PDF
No ratings yet
VMKV Engineering College Department of Computer Science & Engineering Principles of Compiler Design Unit I Part-A
80 pages
Compiler Desing-Final ppt2
PDF
No ratings yet
Compiler Desing-Final ppt2
194 pages
CD Assignment
PDF
No ratings yet
CD Assignment
6 pages
Principles of Compiler Design
PDF
No ratings yet
Principles of Compiler Design
36 pages
CS6660 Compiler Design Question Bank
PDF
100% (3)
CS6660 Compiler Design Question Bank
10 pages
CD Unit2
PDF
No ratings yet
CD Unit2
22 pages
Compiler Design
PDF
No ratings yet
Compiler Design
42 pages
One Line Ques Ans1
PDF
100% (1)
One Line Ques Ans1
11 pages
Program 1, 2 (1) - Merged
PDF
0% (1)
Program 1, 2 (1) - Merged
39 pages
Introduction To Compiler Design-Unit I
PDF
No ratings yet
Introduction To Compiler Design-Unit I
30 pages
Chapter 2 Lexical Analysis
PDF
No ratings yet
Chapter 2 Lexical Analysis
26 pages
Compiler Design Assignment
PDF
100% (1)
Compiler Design Assignment
16 pages
@CD_ch2 compiler design
PDF
No ratings yet
@CD_ch2 compiler design
26 pages
CS3501_CD_QB_Vijayanarayanan
PDF
No ratings yet
CS3501_CD_QB_Vijayanarayanan
12 pages
Compiler_Construction_Lexical_Analysis
PDF
No ratings yet
Compiler_Construction_Lexical_Analysis
63 pages
Introduction For Lab Compiler
PDF
No ratings yet
Introduction For Lab Compiler
15 pages
CS-352 - Spring 2024 - Lec2
PDF
No ratings yet
CS-352 - Spring 2024 - Lec2
35 pages
HW_31712
PDF
No ratings yet
HW_31712
22 pages
Unit2
PDF
No ratings yet
Unit2
61 pages
Compiler Module 1 Important Questions
PDF
No ratings yet
Compiler Module 1 Important Questions
14 pages
Lecture 3- Lexical Analysis (1)
PDF
No ratings yet
Lecture 3- Lexical Analysis (1)
42 pages
Compiler_lexical analyzer-2
PDF
No ratings yet
Compiler_lexical analyzer-2
16 pages
Visvesvaraya Technological University: Artificial Intelligence & Data Science
PDF
No ratings yet
Visvesvaraya Technological University: Artificial Intelligence & Data Science
11 pages
L4 - Lexical Analysis
PDF
No ratings yet
L4 - Lexical Analysis
44 pages
Lexical Analysis
PDF
No ratings yet
Lexical Analysis
88 pages
Compiler Construction
PDF
No ratings yet
Compiler Construction
5 pages
CD Assignment Question Bank
PDF
No ratings yet
CD Assignment Question Bank
20 pages
CS606 Midterm
PDF
No ratings yet
CS606 Midterm
11 pages
UNIT I BKS Lexical Analysis IX - LEX
PDF
No ratings yet
UNIT I BKS Lexical Analysis IX - LEX
17 pages
lexicalanalysis-160516142825
PDF
No ratings yet
lexicalanalysis-160516142825
39 pages
Estd 1919
PDF
No ratings yet
Estd 1919
22 pages
CD - Ch.1
PDF
No ratings yet
CD - Ch.1
28 pages
HarshShivam Internship Report 7 Sem
PDF
No ratings yet
HarshShivam Internship Report 7 Sem
26 pages
Image Net
PDF
No ratings yet
Image Net
2 pages
Image Net
PDF
No ratings yet
Image Net
2 pages
Image Net
PDF
No ratings yet
Image Net
2 pages
Microprocessor Gold 2022
PDF
No ratings yet
Microprocessor Gold 2022
63 pages
Introduction To ImageNet Competition
PDF
No ratings yet
Introduction To ImageNet Competition
10 pages