0% found this document useful (0 votes)
3 views

CD course file

The document is a course file for Compiler Design in the Computer Science and Engineering department for III B.Tech II semester. It includes the vision and mission of the college and department, course objectives and outcomes, syllabus, academic calendar, lesson plans, and various assessment materials. The course aims to provide students with knowledge and skills in compiler design, including phases of compilation, syntax analysis, and code generation.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

CD course file

The document is a course file for Compiler Design in the Computer Science and Engineering department for III B.Tech II semester. It includes the vision and mission of the college and department, course objectives and outcomes, syllabus, academic calendar, lesson plans, and various assessment materials. The course aims to provide students with knowledge and skills in compiler design, including phases of compilation, syntax analysis, and code generation.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 93

DEPARTMENT OF

COMPUTER SCIENCE AND ENGINEERING

III B.TECH II SEMESTER

COMPILER DESIGN

COURSEFILE

1
S.NO CONTENTS
1 Vision&Missionof College
2 Vision&Missionof Department
3 CourseObjectives& Outcomes
4 Syllabus
5 RollList
6 ClassTimeTables
7 SubjectTimeTables
8 AcademicCalender
9 Lesson Plan
11 Lecture Notes(handwritten)
12 TutorialClasses
13 QuestionBank
14 AssignmentQuestions
15 MidQuestionPaperswithSchemaofEvaluationandKey
16 PreviousUniversityQuestion Papers
20 KeyforLatestPreviousQuestionPaper
21 TopicsBeyondSyllabus
19 InternalMarks
20 BestandWorstMidAnswerScripts
21 List ofe-resources
22 ResultSheetpublishedbyUniversity
23 PassPercentage
24 SampleAssignmentSheet
25 AttainmentSheet

2
Institute Vision

To evolve women as a center of excellence in emerging technology and to craft them as global
leaders.

Institute Mission
IM1. To achieve Academic excellence through innovative learning practices.

IM2. To install self confidence among rural students by supplementing with co-curricular and

extra-curricular activities.

IM3. To inculcate universal human values among students.

IM4. To establish centres for Institute Industry partnership in order to enhance their technical

competency and intellectual capabilities.

IM5. To facilitate world class arena to learn and to establish admirable living environment.

Principal

3
Department Vision

To become a global leader in providing academicand research excellence with empowerment skills
for women in the area of Computer Science & Engineering.

Department Mission

DM1. To pioneer education in ComputerScience and Engineering,Mathematics, Management


and Sciences to mould the overall personality of the student.
DM2. To build necessary skills required for employabilitythroughcareerdevelopment training
for adapting the challenges of an ever-changing industrial needs.
DM3. To create interest among students to pursue higher studies.
DM4. To promote research and development in the frontier areas of Computer Science
&Engineering.
DM5. To enrich students with goodcharacter,and highintegritytoservethe society.

HOD

4
Course Name:Compiler Design Branch: CSE Year – Sem : III – II
Regulation: R20 Academic Year: 2024-25

ProgramOutcomes(POs):

5
Engineering Knowledge: Apply the knowledge of mathematics, science, engineering
PO1 fundamentals, and an engineering specialization to the solution of complex
engineering
problems.

Problem Analysis: Identify, formulate, review research literature, and analyze


PO2 complex engineering problems reaching substantiated conclusions using first
principles of
mathematics, natural sciences, and engineering sciences.

Design/Development of Solutions: Design solutions for complex engineering


problems and design system components or processes that meet the specified needs
PO3
with appropriate consideration for the public health and safety, and the cultural,
societal, and environmental
considerations.

Conduct Investigations of Complex Problems: Use research-based knowledge and


PO4 research methods including design of experiments, analysis and interpretation of
data,and synthesis of the information to provide valid conclusions.

Modern Tool Usage: Create, select, and apply appropriate techniques, resources, and
PO5 modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.

The Engineer and Society: Apply reasoning informed by the contextual knowledge
PO6 to assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.

Environment and Sustainability: Understand the impact of the professional


PO7 solutions in societal and environmental contexts, and demonstrate the knowledge of,
and
need for sustainable development.
Ethics: Apply ethical principles and commit to professional ethics and responsibilities
PO8 and
norms of the engineering practice.
Individual and Team Work: Function effectively as an individual, and as a member
PO9 or
leader in diverse teams, and in multidisciplinary settings.
Communication: Communicate effectively on complex engineering activities with
the engineering community and with society at large, such as, being able to
PO10
comprehend and write effective reports and design documentation, make effective
presentations, and give
and receive clear instructions.

6
Project Management and Finance: Demonstrate knowledge and understanding of
PO11 the engineering and management principles and apply these to one’s own work, as a
member
Program Educational Objectives(PEOs):

Graduateswillhavetheexpertisein analyzingrealtimeproblemsandproviding
PEO#1
appropriate solutions related to Computer Science & Engineering.

Graduateswillhavetheknowledgeoffundamentalprinciplesandinnovative technologies
PEO#2
to succeed in higher studies, and research.
Graduateswillcontinuetolearnandtoadapttechnologydevelopmentscombined with
PEO#3 deep awareness of ethical responsibilities in profession.

Program Specific Outcomes(PSOs):

Applyvariousprogrammingskillstodeliverinnovativequality softwareproducts for the


PSO#1
changing business needs.

Utilize the skills of Data Analytics, Cloud Computing, Artificial Intelligence and
PSO#2 MachineLearningtoaddresstechnologicalchallengesinmultidisciplinaryareasof
engineering.

7
HOD

8
Course Name:Compiler Design Branch: CSE Academic Year: 2023-24
Regulation: R20 Year – Sem : III – II

Course Objectives:

 Understand the basic concept of compiler design, and its different phases which will be
helpful to construct new tools like LEX, YACC, etc.

Course Outcomes:
SUBJECT:COMPILER DESIGN

CO.NO
Course Outcomes BT Level
.

C322.1 CO1: Demonstrate phases in the design of compiler Understanding

C322.2 CO2 : Organize Syntax Analysis, Top Down and LL(1) grammars Creating

C322.3 CO3 : Design Bottom Up Parsing and Construction of LR parsers Analyzing

CO4 : Analyze synthesized, inherited attributes and syntax directed


C322.4 Evaluating
translation schemes

C322.5 CO5: Determine algorithms to generate code for a target machine.


Evaluating

9
Course Name:Compiler Design Branch: CSE Year – Sem: III – II
Regulation:R20 Academic Year: 2023-24

CO – PO MAPPING
Course Program
Outcome Specific
s (CO) Program Outcomes (PO’S) Outcomes
(PSO’s)

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO 10 PO 11 PO 12 PSO1 PSO2

3 3 1 - - - - 2 1
C322.1
3 3 3 2 - - - - 2 1
C322.2
3 3 2 2 - - - - 2 1
C322.3
3 3 2 2 - - - - 2 1
C322.4
3 3 3 2 - - - - 2 1
C322.5
3 3 2 2 0 0 0 0 2 1
Avg

3–Strongly linked | 2–Moderately linked | 1–Weakly linked

10
Course Name:Compiler Design Branch: CSE
Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25
CO-PO Mapping Justification

Mapped POs: PO1, PO2 ,PO3,PO4, PO5,PO10,PO12,PS01,PS02.

PO1: Engineering knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering
problems.

PO2 : Problem Analysis: Identify, formulate, review research literature, and


analyze complex engineering problems reaching substantiated conclusions
using first principles of mathematics, natural sciences and engineering
sciences.

PO3: Design/development of solutions: Design solutions for complex engineering problems


anddesign system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations

PO4 :Conduct Investigations of Complex Problems: Use research-based


knowledge and researchmethods including design of experiments, analysis and
interpretation of data.

PO5: Modern Tool Usage: Create, select, and apply appropriate techniques,
resources, and modern engineering and IT tools including prediction and
modeling to complex

engineering activities with an understanding of the limitations.

PO10: Communication: Communicate effectively on complex engineering activities with


the engineering community and with society at large, such as, being able to comprehend and
write effective reports.
11
PO12: Recognize the need for, and have the preparation and ability to engage in independent
and life- long learning in the broadest context of technological change.

PSO1: Applyvariousprogrammingskillstodeliverinnovativequality softwareproducts


for the changing business needs.
PSO2: Utilize the skills of Data Analytics, Cloud Computing, Artificial Intelligence and
MachineLearningtoaddresstechnologicalchallengesinmultidisciplinaryareasof engineering.

C322.1: Demonstrate phases in the design of compiler

C322.1
C322.1-P01 3 Students will be able to apply engineering Knowledge moderately for
different phases of compilation.
C322.1-P02 3 Students will be able to identify mathematical algorithmic knowledge
that helps moderately to analyze given problem for removing ambiguities
in the Syntax Analyzer.
C322.1-P03 3 Students will develop computer programs for Syntax analysis phase of a
compiler.
C322.1-P04 2 Students will recognize the knowledge of constructing finite automata
from regular expression.
C322.1-P05 2 Students will understand selection of LEX tool to design a lexical
analyzer phase of a compiler
C322.1-P10 2 Students will be able to optimize storage organization and effectively
generate machine codes.
C322.1-P012 2 Information acquired from the design of assembler is moderately
applicable for lifelong learning in the context of system software
development.
C322.1-PS01 2 Students will Gain knowledge on design of compiler.

C322.1-PS02 1 Students will Have the knowledge about the compiler construction tools
helps strongly in the study and design of compiler.

C322.2 : Organize Syntax Analysis, Top Down and LL(1) grammars

12
C322.2
C322.2-P01 3 Students will be able to recognize the knowledge of constructing syntax
Analyzer(parser).
C322.2-P02 3 Students will apply the knowledge of compiler design and after reducing
it into a system of Grammers in many areas of the engineering .
C322.2-P03 3 Syntax Analysis, Top Down parsing techniques.

C322.2-P04 2 Students will be able to choose appropriate software tools to conduct the
experiments using lex and yacc.
C322.2-P05 2 Students will be able to figure out top down parsing techniques and
effectively generate machine codes.
C322.2-P10 2 Students will communicate effectively on complex algorithmic
knowledge that helps moderately to analyze given problem for
removing ambiguities in the context free Grammar. C322.3:
Design 2 Students can understand and implement different types Intermediate Bottom
C322.2-P012
Up Representation of code used for generating target code. Parsing
C322.2-PS01 2 Students will apply various information acquir from the fundamentals of
and parsing leads moderately to implement the intermediate code.
C322.2-PS02 1 Information acquired from the fundamentals of intermediate
representation leads moderately for implementation of target code
Construction of LR parsers

C322.3
C322.3-P01 3 Apply engineering Knowledge moderately to design assemblers for
different architectures
C322.3-P02 3 Students can able to solve problems in Bottom Up Parsing.

C322.3-P03 2 Students will be able to implement computer programs for LR parsers


phase of a compiler.
C322.3-P04 2 Students identifies mathematical algorithmic knowledge that helps
moderately to analyze given problem for removing ambiguities in bottom
up parser.
C322.3-P05 1 Students will be able to choose appropriate software tools to conduct the
experiments using bottom up parsing.
C322.3-P10 2 Students will analyze given problem for removing ambiguities in the
SLR Parsers.
C322.4: 1 Information acquired from the compilation phases which is moderately
C322.3-P012
applicable for lifelong learning in the context of Compiler Construction.
C322.3-PS01 2 Students will apply various programming skills to deliver innovative
quality construction of Construction of CLR parsing.
C322.3-PS02 1 Students will have knowledge about the compiler construction tools helps
strongly in the study and design of compiler.

13
C322.4: Analyze synthesized, inherited attributes and syntax directed translation schemes

C322.4
C322.4-P01 3 Knowledge of Ambiguities in the context free Grammar helps students
moderately for analyzing the problems in SDT(syntax directed translation).
C322.4-P02 3 Students will be able identify knowledge that helps moderately to analyze
given problem for removing ambiguities in the SDT.
C322.4-P03 2 Students will select Prefered tool to design a Syntax Directed Translation for
any grammer.
C322.4-P04 2 Students identifies L-Attributed SDD’s to analyze given problem in syntax
directed translation.
C322.4-P05 1 Students will be able design the Applications of Syntax Directed Translation .

C322.4-P10 2 Students will communicate effectively on complex engineering


activities with the engineering community and with society at
arge,such as, being able to comprehend and write effective reports.

C322.4-P012 1 Students will be able to recognize the need for synthesized and inherited
attributes.
C322.4-PS01 2 Ability to implement computer programs for Ability to implement computer
programs for evaluation orders for SDD’s.
C322.4-PS02 1 Students will be able to develop compiler product.

C322.5:
Determine algorithms to generate code for a target machine.

C322.5
C322.5-P01 3 Students will analyze the storage organization for Code Generation Algorithm.

C322.5-P02 3 Students will identify the differences between Register Allocation and
Register Assignment.
C322.5-P03 2 Students will design a method to find a solution for Object Code Forms in
code generation.
C322.5-P04 2 Students will analyze machine code generation effectively and generate target
code using target machine.
C322.5-P05 1 Students will gain knowledge on Heap Management and Dynamic
Programming Code-Generation.
C322.5-P10 2 Students will be able to communicate effectively on programming language
basics for project management using target code.
C322.1-P012 1 Students will learn the methods to apply in real life problems like profit gaining
in Industries.
C322.1-PS01 2 Students will be able to optimize storage organization and effectively generate
machine codes 14
C322.1-PS02 1 Information acquired from the fundamentals of intermediate representation
leads moderately for implementation of target code
Course Name:Compiler Design Branch: CSE Regulation:R20
Year – Sem: III – II Academic Year: 2024-25

SYLLABUS
COMPILER DESIGN

UNIT I: Lexical Analysis: Language Processors, Structure of a Compiler, Lexical Analysis, The
Role of the Lexical Analyzer, Bootstrapping, Input Buffering, Specification of Tokens,
RecognitionofTokens,Lexical AnalyzerGenerator-LEX, FiniteAutomata,RegularExpressions and
Finite Automata, Design of a Lexical Analyzer Generator.

Syntax Analysis: The Role of the Parser, Context-Free Grammars, Derivations, Parse
Trees,Ambiguity,LeftRecursion,LeftFactoring.

UNIT II: TopDownParsing: PreProcessingStepsofTop Down Parsing, Backtracking, Recursive


Descent Parsing, LL (1) Grammars, Non-recursive PredictiveParsing, Handling Ambiguity
GrammarwithLRParsersErrorRecoveryinPredictiveparsing.

BottomUpParsing:Introduction,DifferencebetweenLRandLLParsers,TypesofLR Parsers,Shift
Reduce Parsing,SLRParsers,ConstructionofSLRParsingTables,More Powerful LR Parses,
Construction of CLR (1) and LALR Parsing Tables, Dangling Else Ambiguity, Error Recovery
in LR Parsing.

UNIT III: Syntax Directed Translation: Syntax-Directed Definitions, Evaluation Orders for
SDD’s, Applications of Syntax Directed Translation, Syntax-Directed Translation Schemes,
Implementing L-Attributed SDD’s. Intermediate Code Generation: Variants of Syntax Trees,
ThreeAddressCode,TypesandDeclarations,TranslationofExpressions,TypeChecking,Control
Flow, Backpatching, Intermediate Code for Procedures.

UNITIV:CodeOptimization:ThePrincipleSourcesofOptimization,BasicBlocks,Optimization of
BasicBlocks,Structure Preserving Transformations, Flow Graphs, Loop Optimization, Data-Flow
Analysis, Peephole Optimization.

UNIT V: CodeGeneration: Issues in the Design of a Code Generator, Object Code Forms, Code
15
Generation Algorithm, Register Allocation and Assignment. Run Time Environments: Storage
Organization, Run Time Storage Allocation, Activation Records, Procedure Calls, Displays.

Text Books: 1. Compilers: Principles, Techniques and Tools, Second Edition, Alfred V. Aho,
Monica S. Lam, Ravi Sethi, Jeffry D. Ullman, Pearson Publishers, 2007.

RReferenceBooks:1.CompilerConstruction,PrinciplesandPractice,KennethCLouden,Cengage
Learning, 2006

2. ModerncompilerimplementationinC,AndrewWAppel,Revisededition,CambridgeUniversity
Press.
3. OptimizingCompilersforModernArchitectures,RandyAllen,KenKennedy,Morgan Kauffmann,
2001.

4. Levine,J.R.,T.MasonandD.Brown,LexandYacc,edition,O'Reilly&Associates,1990

16
Course Name:Compiler Design Branch: CSE
Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25

III B.TECH CSE ROLL LIST


1 226W1A0501 ANTHARVEDI PALEM SIRISHA
2 226W1A0502 AMBATI DEVI AMRUTHA KALYANI
3 226W1A0503 AVIDI SWATHI
4 226W1A0504 BALINA BHUVANESWARI
5 226W1A0505 BHIMADOLU PAVANI
6 226W1A0506 BOGADI NEELIMA
7 226W1A0507 CHADUVULA CHARMI
8 226W1A0508 CHINTA SOFFY ROSLIN VARMA
9 226W1A0509 CHIRIKI ANISHMA
10 226W1A0510 GAMPARAI NANDINI
GANNABATHULA SRI VIJAYA LAKSHMI
11 226W1A0511 KAVYA HARSHITHA
12 226W1A0512 GARRE TEJASWI
13 226W1A0513 GAVIREDDI HARITHA UMALAKSHMI
14 226W1A0514 GORLE VASUNDHARA
15 226W1A0515 GUBBAL AISWARYA
16 226W1A0516 GUNNAM INDU
17 226W1A0517 HEMA BUDHA
18 226W1A0518 JALLURI.NIHARIKA
19 226W1A0519 KADALI SWETHA GAYATHRI
20 226W1A0520 KADALI HARIKA
21 226W1A0521 KAKILETI DIVYASRI
22 226W1A0522 KANKIPATI SRAVANTHI
23 226W1A0523 KANUKOLANU SANJANA
24 226W1A0524 KARUMURI PALLAVI
25 226W1A0525 KASA NAVYA SRI DURGA
26 226W1A0527 KATTA MONIKA LAKSHMI DURGA
27 226W1A0528 KOLAGANA SRAVANI
28 226W1A0529 KOLLI PAVANI
29 226W1A0530 KONDLA BHASHINI AKSHAYA
30 226W1A0531 KOPPARTHI MAMATHA
31 226W1A0532 KUMPATI SRAVANTHI
32 226W1A0533 KUNDUM JGNANESWARI MANIKYAMBA
33 226W1A0534 17
MANDAPALLI SUGUNA SRI LASYA
34 226W1A0535 MERUGU DIVYA SANTOSHINI
35 226W1A0536 MERUGU RAMYA
36 226W1A0537 MUNGARA MAMATHA GRACE
37 226W1A0538 MUTTA SRI SUNANDA
38 226W1A0539 MUTTAMSETTI NAGA DURGA
39 226W1A0540 NUNE TRISHIKA
40 226W1A0541 PANGI NAVYA KALA
41 226W1A0542 PAPPALA YAMUNA VEERA VARA LAKSHMI
42 226W1A0543 PASUPULETI MADURYA SAI
43 226W1A0544 PATRA SANTHI PRIYA
44 226W1A0545 PERAVALLI HEMA VAISHNAVI
POLYREDDY UMA VIJAYA DURGA
45 226W1A0546 SRINIVASA HARINI
46 226W1A0547 PULAKALA POOJA
47 226W1A0548 SABBITHI.SRAVANI
48 226W1A0549 SALADI PURNA SRI
49 226W1A0550 SAVARAPU SUPRIYA
50 226W1A0551 SHEIK HASINA BIBI
51 226W1A0552 SUNKARA GANGA PRASANNA
52 226W1A0553 TIRUMALA SETTI KALYANI
53 226W1A0554 THIRRI MOUNIKA DEVI
54 226W1A0555 THOTA VENKATA KEERTHI PUJITHA
55 226W1A0556 UPPULURI PHANITHA SATYA SRI
56 226W1A0557 VAKADA RAMANAMMA
57 226W1A0558 VALLABHANENI VIJAYA LAKSHMI
58 226W1A0559 VEMALA SAI SRAVANI
59 226W1A0560 VINTI HEMA LAVANYA
60 226W1A0561 VYSYARAJU MEGHANA
61 226W1A0562 YEDULLA LIKHITHA
62 226W1A0563 ADIMULAM GAYATHRI SIVA NAGESWARI
63 226W1A0564 ALLU JHANSI DURGA
64 226W1A0565 ARIGELA SURYA ROSHINI
65 226W1A0566 BAKKA.LAKSHMI PRASANNA
66 226W1A0567 BATHULA CHARISHMA GIRIBALA
67 226W1A0568 BODDA SUCHITRA
68 226W1A0569 BOGA HEMA DURGA PRASANTHI
69 226W1A0570 CHAGANTI SWATHI SATYA SRI
70 226W1A0571 CHENNAMSETTI GAYATHRI
71 226W1A0572 CHUNDRU KAMALA
72 226W1A0573 DONGARA SAI SANTHOSHI
73 226W1A0574 GALLA CHARAN DEEPIKA
74 226W1A0575 JYOTHULA KEERTHI
75 226W1A0576 KAKARA HARIKA
KAKI SRI NAGA VEERA LAKSHMI
76 226W1A0577 YOSHITHA
77 226W1A0578 KAKKALA PAVANI DEVI
78 226W1A0579 KANCHARLA LAVANYA
79 226W1A0580 KANDUKURI SUMA SRI
80 226W1A0581 KARIBANDI SAI LAHARI
81 226W1A0582 KETHA SRAVANTHI
82 226W1A0583 KOKKIRIPATI NAVYA
83 226W1A0584 KONIJETI.DHAKSHAYANI
84 226W1A0585 KUCHIMANCHI SESHA SAI SRAVANTHI
85 226W1A0586 KURUKURI MADHURYA
86 226W1A0587 MADDILA PUJITHA
87 226W1A0588 MAJETI LAKSHMI SRUJANA
88 226W1A0589 MALLA VIJAYA SAI CHARISHMA
88 226W1A0590 18
MANNEPUDI BHUVANESWARI
89 226W1A0591 MEDISETTI GIRIJA
90 226W1A0592 MOHAMMAD NUSRATH
91 226W1A0593 MUMMANA DURGA BHAVANI
HOD

19
20
Course Name:Compiler Design Branch: CSE
Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25

ClassTime Tables
TIME TABLE FOR III B.Tech CSE (A) Section

1 2 3 4 5 6 7
DAY/ 1:00-
TIME 9:30- 10:20 - 11:20- 12:10- 2:00 2:00- 2.50-
10:20 11:10 12:10 1:00 2:50 3:40 3:40-4:30
SEMINAR
MON OOAD CD POC ML CNS SPORTS
ON OOAD
SEMINA

LUNCHBREAK
TUE
CNS OOAD CD POC ML R ON LIBRARY
POC
SEMINAR
WED ML OOAD CNS POC CD SPORTS
ON ML
SEMINA
THU POC CNS CD OOAD ML LIBRARY
R ON CD
SEMINAR
FRI ML CD OOAD CNS POC SPORTS
ON CNS
SEMINAR
SAT CD OOAD CNS POC ML LIBRARY
ON ML

OOAD- OBJECT ORIENTED ANALYSIS AND DESIGN.


CD- COMPILER DESIGN.
POC-PRINCIPLES OF COMMUNICATION.
ML-MACHINE LEARNING.
CNS- CRYPTOGRAPHY NETWORK SECURITY.

HOD

21
Course Name:Compiler Design Branch: CSE

Regulation:R20 Academic Year: 2024-25


Year – Sem: III – II

TIME TABLE FOR III B.Tech CSE (B) Section

1 2 3 4 5 6 7
DAY/ 1:00-
TIME 9:30- 10:20 - 11:20- 12:10- 2:00 2:00- 2.50-
10:20 11:10 12:10 1:00 2:50 3:40 3:40-4:30
SEMINAR
MON POC OOAD ML CNS CD LIBRARY
ON CD
SEMINA
TUE CD ML OOAD CNS POC SPORTS
LUNCHBREAK
R ON ML
SEMINAR
WED CNS POC OOAD CD ML LIBRARY
ON POC
SEMINAR
THU CD ML OOAD CNS POC SPORTS
ON CNS
SEMINAR
FRI CNS OOAD POC ML CD LIBRARY
ON OOAD
SEMINAR
SAT OOAD ML POC CD CNS SPORTS
ON ML

OOAD- OBJECT ORIENTED ANALYSIS AND DESIGN.


CD- COMPILER DESIGN.
POC-PRINCIPLES OF COMMUNICATION.
ML-MACHINE LEARNING.
CNS- CRYPTOGRAPHY NETWORK SECURITY.

HOD

22
Course Name:Compiler Design Branch: CSE
Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25
Subject Time Tables
1 2 3 4 5 6 7
DAY/ 1:00-
TIME 9:30- 10:20- 11:20- 12:10- 2:00 2:00- 2.50-
3:40-4:30
10:20 11:10 12:10 1:00 2:50 3:40

MON III CSE-A III CSE-B

LUNCH
TUE III CSE-B III CSE-A

WED III CSE-B III CSE-A

BREAK
THU III CSE-B III CSE-A

FRI III CSE-A III CSE-B


SAT III CSE-A III CSE-B

HOD

23
Course Name:Compiler Design Branch: CSE
Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25
Academic Calendar

III.B.Tech II Semester AcademicYear(2024-2025)

Description From To Weeks


Commencementof
01-12-2024
ClassWork
I Unit of Instructions 01-12-2024 25-01-2025 8 Weeks

I Mid Examinations 27-01-2025 01-02-2025 1 Week

II Unit of Instructions 03-02-2025 29-03-2025 8 Weeks

II Mid Examinations 01-04-2025 04-04-2025 1 Week

Preparation and
07-04-2025 12-04-2025 1 Week
Practical’s

End Examinations 15-04-2025 26-04-2025 2 Weeks

Principal

24
Course Name:Compiler Design Branch: CSE
Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25

LESSON PLAN
UNIT-I : Lexical Analysis

No. of Tentative Actual Teaching TB and


S.No. Topics to be covered Classes Date of Date of Learning Page
Required Completion Completion Methods Number
02/31/2024- 02/31/2024 White RB1, 11
1. 2
03/31/2024 03/31/2024 board and
Introduction- Compiler Design, marker
Language Processors
04/31/2024 04/31/2024 White RB1, 14
2. 2
board and
Structure of a Compiler, Lexical 05/31/2024 05/31/2024
marker
Analysis
05/31/2024 05/31/2024 White RB1, 17
3. 2
board and
06/31/2024 06/31/2024
marker
The Role of the Lexical Analyzer
07/31/2024 07/31/2024 White RB1, 20
4. 2
board and
09/31/2024 09/31/2024
marker
Bootstrapping, Input Buffering
10/31/2024 10/31/2024 White RB1, 23
5. 2
Specification of Tokens, board and
11/31/2024 11/31/2024
Recognition of Tokens, Lexical marker
Analyzer Generator-LEX
12/31/2024 12/31/2024 White RB1, 26
6. 3
board and
14/31/2024 14/31/2024
Finite Automata, Regular marker
Expressions and Finite Automata
No. of classes required to complete UNIT-I
13

25
UNIT-II : Top Down Parsing

No. of Tentative Actual Teaching TB and


S.No. Topics to be covered Classes Date of Date of Learning Page
Require Completion Completion Methods Number
d
16/31/2024- 16/31/2024- White RB1, 29
1. 2
17/31/2024 17/31/2024 board and
marker
The Role of the Parser, Context-Free
Grammars
18/31/2024 18/31/2024 White RB1, 31
2. 2
board and
19/31/2024 19/31/2024
marker
Derivations, Parse Trees
20/31/2024 20/31/2024 White RB1, 34
3. 2
board and
21/31/2024 21/31/2024
marker
Ambiguity, Left Recursion
23/31/2024 23/31/2024 White RB1, 37
4. 2
board and
24/31/2024 24/31/2024
marker
Left Factoring,
26/31/2024 26/31/2024 White RB1, 39
5. 2
board and
27/31/2024 27/31/2024
Top Down Parsing: Pre Processing marker
Steps of Top Down Parsing
28/31/2024 28/31/2024 White RB1, 42
6. 3
board and
30/31/2024 30/31/2024
LL (1) Grammars, Non-recursive marker
Predictive Parsing
28/31/2024 28/31/2024 White RB1, 42
7. 2
board and
30/31/2024 30/31/2024
marker
Error Recovery in Predictive Parsing
No. of classes required to complete UNIT-II
15

26
UNIT-III: Syntax Directed Translation

No. of Tentative Actual Teaching TB and


S.No. Topics to be covered Classes Date of Date of Learning Page
Required Completion Completion Methods Number
31/31/2024- 31/31/2024- White RB1, 35
1. 2
02/31/2025 02/31/2025 board and
Introduction: Difference between marker
LRand LL Parsers
3/01/2025 – 3/01/2025- White RB1, 38
2. 2
4/01/2025 4/01/2025 board and
Types of LR Parsers marker
6/01/2025- 6/01/2025- White RB1, 44
3. 2
7/01/2025 board and
Shift Reduce Parsing 7/01/2025
marker
Unit IV: Run Time8/01/2025-
Environments
8/01/2025- White RB1, 47
4. 2
9/01/2025 9/01/2025 board and
SLR Parsers marker
10/01/2025- 10/01/2025- White RB1, 49
5. Construction of SLR Parsing 2 11/01/2025 11/01/2025 board and
Tables marker
20/01/2025- 20/01/2025- White RB1, 32
6. 3
21/01/2025 21/01/2025 board and
More Powerful LR Parses marker
22/01/2025- 22/01/2025- White RB1, 46
7. Construction of CLR (1) and LALR 2
23/01/2025 23/01/2025 board and
Parsing Tables marker
No. of classes required to complete UNIT-III
15

UNIT-IV: Code Optimization

27
No. of Tentative Actual Teachin TB and
S.No. Topics to be covered Classes Date of Date of g Page
Required Completion Completion Learni Number
ng
Metho
ds
24/01/2025- 24/01/2025 White RB1, 48
1. 2
26/01/2025 - board
and
26/01/202
marker
Storage Organization 5
24/01/2025- 24/01/2025 White RB1, 50
2. 2
25/01/2025 - board
25/01/2025 and
Run Time Storage Allocation marker
27/01/2025- 27/01/2025- White RB1, 52
3. 2
28/01/2025 board
28/01/2025
and
Activation Records, Procedure Calls marker
29/01/2025- 29/01/2025- White RB1, 55
4. 2
30/01/2025 30/01/2025 board
Code Optimization: The Principle and
Sources of Optimization marker
31/01/2025- 31/01/2025- White RB1, 57
5. 2
01/02/2025 01/02/2025 board
Basic Blocks, Optimization of Basic and
Blocks marker
02/02/2025- 02/02/2025- White RB1, 60
6. 3
03/02/2025 03/02/2025 board
and
Structure Preserving Transformations marker
04/02/2025- 04/02/2025- White RB1, 63 Unit
7 2
V: 05/02/2025 05/02/2025 board Code
and
Flow Graphs marker
06/02/2025- 06/02/2025- White RB1, 65
8 2
07/02/2025 07/02/2025 board
and
Loop Optimization marker
10/02/2025- 10/02/2025- White RB1, 67
9 2
11/02/2025 11/02/2025 board
and
Data-Flow Analysis marker
12/02/2025- 12/02/2025- White RB1, 69
10 3 13/02/2025 13/02/2025 board
and
Peephole Optimization marker
No. of classes required to complete UNIT-IV
13

Generation
28
No. of Tentative Actual Teaching TB and
S.No Topics to be covered Classes Date of Date of Learning Page
Required Completion Completion Methods Number
.
14/02/2025- 14/02/2025- White RB1, 72
1. 2
15/02/2025 board and
15/02/2025
Storage Organization marker
17/02/2025- 17/02/2025- White RB1, 75
2. 2
18/02/2025 18/02/2025 board and
Run Time Storage Allocation marker
19/02/2025- 19/02/2025- White RB1, 77
3. 2
20/02/2025 board and
Activation Records, Procedure Calls 20/02/2025
marker
21/02/2025- 21/02/2025- White RB1, 79
4. Code Optimization: The Principle 2
22/02/2025 board and
Sources of Optimization 22/02/2025
marker
24/02/2025- 24/02/2025- White RB1, 80
5. Basic Blocks, Optimization of Basic 2 24/02/2025 board and
Blocks 24/02/2025
marker
25/02/2025- 25/02/2025- White RB1, 84
6. 3
27/02/2025 board and
Structure Preserving Transformations 27/02/2025
marker
28/02/2025- 28/02/2025- White RB1, 89
7 2
01/03/2025 01/03/2025 board and
Flow Graphs marker C&T:
03/03/2025- 03/03/2025- White RB1, 91
8 2
04/03/2025 04/03/2025 board and
Loop Optimization marker
05/03/2025- 05/03/2025- White RB1, 93
9 2 06/03/2025 06/03/2025 board and
Data-Flow Analysis marker
07/03/2025- 07/03/2025- White RB1, 96
10 3
08/03/2025 08/03/2025 board and
Peephole Optimization marker
No. of classes required to complete UNIT-V
13

Chalk& Talk
Text Book: T1:
Compilers:Principles, Techniques and Tools, Second Edition, Alfred V. Aho, Monica S
Pearson Publishers, 2007.
Text Book:T2: Optimizing Compilers for Modern Architectures, Randy Allen, Ken Kennedy, Morgan Kauffmann,

Reference Books: RB1: Levine, J.R., T. Mason and D. Brown, Lex and Yacc, edition, O'Reilly & Associates, 1990.

Web References:

29
W1 202.113.80.118:8080/sjjg/upLoad/down/.../20120704005.doc

W2 baggins.nottingham.edu.my/~hsooihock/G52CMP/semantic.ppt

W3 books.google.co.in/books?isbn=8131707881

Signature of the Faculty HOD

Course Name: Compiler Design Branch: CSE


Regulation: R20 Year – Sem: III – II
Academic Year: 2024-25

Question Bank

Unit1:

1.What are the phases of the compiler.

2.Discuss role of lexical analyzer.

3.What is input Buffering?

4.What is Regular expression for the Identifiers.

5.What is the Recognization of Tokens.

6 Explain Differences between compiler and interpreter.

7. Explain about Lex tool.

8. .Discuss about Language processing system

9. Define interpreter.

10. What are the differences between the NFA and DFA?

Unit 2:

1. Explain the role of parser. Explain types of grammars used for parsing.

30
2. Write an algorithm for constructing a predictive parsing table. Give an Example.

3. What is an ambiguous grammar? Write a procedure to eliminate the same with


an example

4. Write about various types of top down parsing. Discuss about the error recover
in predictive parsing.

5. Define context free grammer.

6. Compare the LR Parsers.

7. Differentiate between top down parsers,

8. Define Dead code elimination?

9. Explain bottom up parsing method.

10. Eliminate immediate left recursion for the following grammar.

E->E+T | T
T->T* F | F
F-> (E) | id

Unit 3:

1. How to handle ambiguity through LR parsers? Discuss about the Dangling – Else ambiguity
2. Write the rules used to construct SLR Parser. Give example
3. Write and explain the LR Parsing algorithm.
4. What are different intermediate code forms? Discuss different Three Address code types and
implementations of Three Address statements.
5. What are the various types of intermediate code representation?
6. Write a note on the specification of a simple type checker.
7. State general activation record?
8. Explain type expression and type systems.
9. Define Type Equivalence.
10. Define left most derivation and right most derivation with example.
31
Unit 4:

1. Explain various storage allocation strategies with its merits and demerits.

2. Define activation records. Explain how?

3. What is runtime stack? Explain the storage allocation strategies used for recursive procedure
calls. What is a flow graph?

4. What is the role of code Optimizer in compiler? Is it a mandatory phase? Explain the various
sources of optimization.

5. Describe Loop unrolling? Describe its advantage with your own examples.

6. Explain static and stack storage allocations?.

7. Write the quadruple for the following expression (x + y)∗(y + z) + (x + y + z).

8. What is a DAG? Mention its applications.

9. What are Abstract Syntax trees?

10. What is a Flow graph?

Unit-5:

1. Explain the code generation algorithm in detail with an example.

2. Discuss basic blocks and flow graphs with an example.

3. Explain the main issues in code generation.

4. What are the induction variables?

5. Explain about code motion.

6. What is machine independent code optimization?

7. Write a short note on copy Propagation.

8. Write a short note on Flow graph.


32
9. Explain data-flow schemas on basic blocks with flow graphs.

10. Explain in brief about different Principal sources of optimization techniques with
suitable examples.

33
ASSIGNMENT QUESTIONS

Assigned Date: 13-02-2025 Submitted Date:17-02-2025

Assignment-1:

1.What are the phases of the compiler?( Remembering )

2.Disuss role of lexical analyzer?(Creating)

3.What is input Buffering?(Remembering)

4.What is Regular expression for theIdentifiers?( Remembering)

Key for the Assignment questions

Assignment-1:
1.
Phases of a compiler: A compiler operates in phases. A phase is a logically interrelated operation that takes
source program in one representation and produces output in another representation. The phases of a
compiler are shown in below
There are two phases of compilation.
a. Analysis (Machine Independent/Language Dependent)
b. Synthesis(Machine Dependent/Language independent) Compilation process is partitioned
into no-of-sub processes called ‘phases’.

34
Lexical Analysis:-
LA or Scanners reads the source program one character at a time, carving the source program into a
sequence of automic units called tokens.
Syntax Analysis:-
The second stage of translation is called Syntax analysis or parsing. In this phase expressions, statements,
declarations etc… are identified by using the results of lexical analysis. Syntax analysis is aided by using
techniques based on formal grammar of the programming language.
Intermediate Code Generations:-
An intermediate representation of the final machine language code is produced.
This phase bridges the analysis and synthesis phases of translation.
Code Optimization :-
This is optional phase described to improve the intermediate code so that the output runs faster and takes
less space.
Code Generation:-
The last phase of translation is code generation. A number of optimizations to reduce the length of
machine language program are carried out during this phase. The output of the code generator is the
machine language program of the specified computer.

2.
ROLE OF LEXICAL ANALYZER
The LA is the first phase of a compiler. It main task is to read the input character and produce as output a
sequence of tokens that the parser uses for syntax analysis.

35
Upon receiving a ‘get next token’ command form the parser, the lexical analyzer reads the input character
until it can identify the next token. The LA return to the parser representation for the token it has found.
The representation will be an integer code, if the token is a simple construct such as parenthesis, comma or
colon.

LA may also perform certain secondary tasks as the user interface. One such task is striping out from the
source program the commands and white spaces in the form of blank, tab and new line characters. Another
is correlating error message from the compiler with the source program.

3.

The LA scans the characters of the source pgm one at a time to discover tokens. Because of large amount of time can
be consumed scanning characters, specialized buffering techniques have been developed to reduce the amount of
overhead required to process an input character.
Buffering techniques:
1. Buffer pairs
2. Sentinels

lexical analyzer scans the characters of the source program one a t a time to discover tokens. Often,

however, many characters beyond the next token many have to be examined before the next token itself
can be determined. For this and other reasons, it is desirable for the lexical analyzer to read its input
from an input buffer. Figure shows a buffer divided into two haves of, say 100 characters each. One
pointer marks the beginning of the token being discovered. A look ahead pointer scans ahead of the
beginning point, until the token is discovered. we view the position of each pointer as being between the
character last read and the character next to be read. In practice each buffering scheme adopts one
convention either appointer is at the symbol last read or the symbol it is ready to read.

36
Token beginnings look ahead pointer The distance which the lookahead pointer may have to travel past
the actual token may be large. For example, in a PL/I program we may see: DECALRE (ARG1,
ARG2… ARG n) Without knowing whether DECLARE is a keyword or an array name until we see the
character that follows the right parenthesis. In either case, the token itself ends at the second E. If the
look ahead pointer travels beyond the buffer half in which it began, the other half must be loaded with
the next characters from the source file. Since the buffer shown in above figure is of limited size there is
an implied constraint on how much look ahead can be used before the next token is discovered. In the
above example, if the look ahead traveled to the left half and all the way through the left half to the
middle, we could not reload the right half, because we would lose characters that had not yet been
grouped into tokens. While we can make the buffer larger if we chose or use another buffering scheme,
we cannot ignore the fact that overhead is limited.

4.
Regular expression is a formula that describes a possible set of string.
Component of regular expression..
Xthe character x
. any character, usually accept a new line [x y z] any of the characters x, y, z, …..
R?a R or nothing (=optionally as R)
R*zero or more occurrences…..
R+one or more occurrences …… R1R2 an R1 followed by an R2 R2R1 either an R1 or an
R2.
A token is either a single string or one of a collection of strings of a certain type. If we view the set of
strings in each token class as an language, we can use the regular-expression notation to describe tokens.

Consider an identifier, which is defined to be a letter followed by zero or more letters or digits. In regular
expression notation we would write.

Identifier = letter (letter | digit)*


Here are the rules that define the regular expression over alphabet .

o is a regular expression denoting { € }, that is, the language containing only the empty string.
o For each ‘a’ in ∑, is a regular expression denoting { a }, the language with only one string
consisting of the single symbol ‘a’ .
o If R and S are regular expressions, then
37
(R) | (S) means LrULs
R.S means Lr.Ls R* denotes Lr*

REGULAR DEFINITIONS:

For notational convenience, we may wish to give names to regular expressions and to define
regular expressions using these names as if they were symbols.
Identifiers are the set or string of letters and digits beginning with a letter. The following regular
definition provides a precise specification for this class of string.
Example-1,
Ab*|cd? Is equivalent to (a(b*)) | (c(d?)) Pascal identifier
Letter - A | B | ……| Z | a | b |……| z| Digits - 0 | 1 | 2 | …. | 9
Id - letter (letter / digit)*

parser for any grammar is program that takes as input string w (obtain set of strings tokens from the
lexical analyzer) and produces as output either a parse tree for w, if w is a valid sentences of
grammar or error message indicating that w is not a valid sentences of given grammar. The goal of
the parser is to determine the syntactic validity of a source string is valid, a tree is built for use by the
subsequent phases of the computer. The tree reflects the sequence of derivations or reduction used
during the parser. Hence, it is called parse tree. If string is invalid, the parse has to issue diagnostic
message identifying the nature and cause of the errors in string. Every elementary subtree in the
parse tree corresponds to a production of the grammar.
There are two ways of identifying an elementary subtree:

1. By deriving a string from a non-terminal or


2. By reducing a string of symbol to a non-terminal.

The two types of parsers employed are:


a. Top down parser: which build parse trees from top(root) to bottom(leaves)
b. Bottom up parser: which build parse trees from leaves and work up the root.

38
2.
Predictive parsing is a special case of recursive descent parsing where no backtracking is
required.
The key problem of predictive parsing is to determine the production to be applied for a
non-terminal in case of alternatives.
Non-recursive predictive parser

The table-driven predictive parser has an input buffer, stack, a parsing table and
an output stream.
Input buffer:
It consists of strings to be parsed, followed by $ to indicate the end of the input
string.
Stack:
It contains a sequence of grammar symbols preceded by $ to indicate the bottom
of the stack. Initially, the stack contains the start symbol on top of $.
Parsing table:
It is a two-dimensional array M[A, a], where ‘A’ is a non-terminal and ‘a’ is a
terminal.
Predictive parsing program:
The parser is controlled by a program that considers X, the symbol on top of stack, and
a, the current input symbol. These two symbols determine the parser action. There are
three possibilities:
1. If X = a = $, the parser halts and announces successful completion of
parsing.
2. If X = a ≠ $, the parser pops X off the stack and advances the input pointer
39
to the next input symbol.
3. If X is a non-terminal , the program consults entry M[X, a] of the parsing
table
M. This entry will either be an X-production of the grammar or an error entry
3.

A grammar that produces more than one parse for some sentence is said to be ambiguous
grammar

Example : Given grammar G : E → E+E | E*E | ( E ) | - E | id

The sentence id+id*id has the following two distinct leftmost derivations: E → E+ E
E → E* E
E → id + E E → E + E * E
E → id + E * E E → id + E * E
E → id + id * E E → id + id * E
E → id + id * id E → id + id * id

The two corresponding parse trees are :

Example:
To disambiguate the grammar E → E+E | E*E | E^E | id | (E), we can use
precedence of operators as follows:
^ (right to left)
/,* (left to right)
-,+ (left to right) We get the following unambiguous grammar:

40
E → E+T | T
T → T*F | F F → G^F | G G → id | (E)
Consider this example, G: stmt→ if expr then stmt|if expr then stmtelsestmt| other This

grammar is ambiguous since the string if E1 then if E2 then S1 else S2 has the following.

Two parse trees for leftmost derivation :

To eliminate ambiguity, the following grammar may be used:


41
stmt→ matched_stmt| unmatched_stmt
matched_stmt→ if expr then matched_stmtelse matched_stmt| other unmatched_stmt→ if expr
then stmt| if expr then matched_stmtelse unmatched_stmt
4.It can be viewed as an attempt to find a left-most derivation for an input string construct a parse
tree .

Mid-I Question Paper

Course: B.Tech
Branch: CSE Year/Semester: III/II
Reg: R20
Subject: Compiler Design

SET-I

1 Design the phases of compiler with neat sketch BT 6


2 SET-II
Discuss in detail about LEX Process in detail with neat BT 4
sketch?
13 Discuss
Explain the terms
about Compiler,
parser Pre
and their Processor,
types and explain about BT 13
Interpreter
Ambiguity in syntax Analysis?
2 Justify the purpose of bootstrapping with neat sketch BT 6
3 Explain the role of parser and SET-III
their types? And explain BT 3
the steps of top down parsing 42
SET-III

1 Design the structure of compiler with neat sketch? BT 6


2 What is the purpose of two buffer scheme? Explain BT 5
with suitable example
3 Write a detailed note on CFG? BT 1
SET-IV

1 Design the phases of compiler with neat sketch? BT 6


2 What is Input Buffering? Explain about the types of BT 5
input buffering?
3 Write a detailed note on bootstrapping with neat BT 4
sketch?

Key for the mid-1 questions

Set-1 key:
1)
Phases of a compiler: A compiler operates in phases. A phase is a logically interrelated operation
that takes source program in one representation and produces output in another representation. The
phases of a compiler are shown in below
There are two phases of compilation.
a. Analysis (Machine Independent/Language Dependent)
b. Synthesis(Machine Dependent/Language independent) Compilation process is
partitioned into no-of-sub processes called ‘phases’.

43
LexicalAnalysis:-
LA or Scanners reads the source program one character at a time, carving the
sourceprogram into a sequence of automic units called tokens.
Syntax Analysis:-
The second stage of translation is called Syntax analysis or parsing. In this
phase expressions, statements, declarations etc… are identified by using the
results of lexical analysis. Syntax analysis is aided by using techniques based
on formal grammar of the programming language.
IntermediateCodeGenerations:-
Anintermediaterepresentationofthefinalmachinelanguage codeis produced.
thisphasebridgestheanalysis andsynthesisphasesof translation.
CodeOptimization:-
This is optional phase described to improve the intermediate code so that the
output runs faster and takes less space.
Code Generation:-
The last phase of translation is code generation. A number of optimizations
to reduce the length of machine language program are carried out during
this phase. The output of the code generator is the machine language program
of the specified computer.

2) ROLE OF THE PARSER

44
Parserobtainsastringoftokensfromthelexicalanalyzerandverifiesthatitcanbegenerat
ed by the language for the source program. The parser should report any syntax
errors in an intelligible fashion. The two types of parsers employed are:
1. Topdownparser:
2. Bottomupparser:
Therefore therea retwo types of parsing methods– top-down parsing and bottom-up parsing

3) Lex in Compiler Design

Lex is a tool or a computer program that generates Lexical Analyzers (converts the stream of
characters into tokens). The Lex tool itself is a compiler. The Lex compiler takes the input and
transforms that input into input patterns. It is commonly used with YACC(Yet Another Compiler
Compiler). It was written by Mike Lesk and Eric Schmidt .
Function of Lex
1. In the first step the source code which is in the Lex language having the file name ‘File.l’ gives as
input to the Lex Compiler commonly known as Lex to get the output as lex.yy.c.

Set-2 key:
1)
Compiler

Compiler is a translator program that translates a program written in (HLL) the source
program and translate it into an equivalent program in (MLL) the target program. As an
45
important part of a compiler is error showing to the programmer.

SourcepgmCompiler targetpgm

Error msg

executing a program written n HLL programming language is basically of two parts. The source
program must first be compiled and translated into a object program. Then the resulting object
program is loaded into a memory executed.

Interpreter: An interpreter is a program that appears to execute a source program as if


it were machine language.

Languages such as BASIC, SNOBOL, LISP can be translated using interpreters. JAVA
also uses interpreter. The process of interpretation can be carried out in following
phases.
1. Lexicalanalysis
2. Synatxanalysis
3. Semanticanalysis
4. DirectExecution
Advantages:
Modificationofuserprogramcanbeeasilymadeandimplementedasexecution proceeds.
5. Typeofobject thatdenotesavariousmay changedynamically.
Debuggingaprogramandfindingerrorsissimplifiedtaskforaprogramused for
interpretation.
Theinterpreterfor thelanguagemakes itmachineindependent.

Disadvantages:
Theexecutionoftheprogramisslower. Memory
consumption is more.

2) Bootstrapping is an important technique in compiler design, where a basic compiler is used to create a
more advanced version of itself. This process helps in building compilers for new programming languages
and improving the ones already in use. By starting with a simple compiler, bootstrapping allows gradual
improvements and makes the compiler more efficient over time.
46
Bootstrapping relies on the idea of a self-compiling compiler, where each iteration improves the compiler’s
ability to handle more complex code.
it simplifies the development cycle, allowing incremental improvements and faster deployment of more
robust compilers.
Many successful programming languages, including C and Java, have used bootstrapping techniques during
their development.

3)ROLE OF THE PARSER

Parserobtainsastringoftokensfromthelexicalanalyzerandverifiesthatitcanbegenerated by the language for the


source program. The parser should report any syntax errors in an intelligible fashion. The two types of parsers
employed are:
3. Topdownparser:
4. Bottomupparser:
Thereforetherearetwo types of parsing methods– top-down parsing and bottom-up parsing

SET-3 KEY:

1)
Compiler

Compiler is a translator program that translates a program written in (HLL) the source
program and translate it into an equivalent program in (MLL) the target program. As an
important part of a compiler is error showing to the programmer.

Sourcepgm Compiler targetpgm

Error msg

47
executing a program written n HLL programming language is basically of two parts. The source program
must first be compiled and translated into a object program. Then the resulting object program is loaded into
a memory executed.

2) Two Buffer Scheme: To overcome the problem of one buffer scheme, in this method two buffers are
used to store the input string. the first buffer and second buffer are scanned alternately. when end of
current buffer is reached the other buffer is filled. the only problem with this method is that if length of
the lexeme is longer than length of the buffer then scanning input cannot be scanned completely.
Initially both the bp and fp are pointing to the first character of first buffer. Then the fp moves towards
right in search of end of lexeme. as soon as blank character is recognized, the string between bp and fp
is identified as corresponding token. to identify, the boundary of first buffer end of buffer character
should be placed at the end first buffer. Similarly end of second buffer is also recognized by the end of
buffer mark present at the end of second buffer. when fp encounters first eof, then one can recognize end
of first buffer and hence filling up second buffer is started. in the same way when second eof is obtained
then it indicates of second buffer. alternatively both the buffers can be filled up until end of the input
program and stream of tokens is identified. This eof character introduced at the end is
calling Sentinel which is used to identify the end of buffer.

Advantages:

Input buffering can reduce the number of system calls required to read input from the source code,
which can improve performance.
Input buffering can simplify the design of the compiler by reducing the amount of code required to
manage input.

Disadvantages:

If the size of the buffer is too large, it may consume too much memory, leading to slower
performance or even crashes.
If the buffer is not properly managed, it can lead to errors in the output .

3) ContextfreeGrammars(CFG)
CFGisusedtospecifythesyntaxofalanguage.Agrammarnaturallydescribesthe hierarchical
structure of most program-ming language constructs.

48
FormalDefinitionofGrammars

Acontext-freegrammarhasfour components:
1. Asetofterminalsymbols,sometimesreferredtoas"tokens."Theterminalsaretheelementary
symbols of the language defined by the grammar.
2. Asetofnonterminals,sometimescalled"syntacticvariables."Eachnon-
terminalrepresentsasetof strings of terminals, in a manner we shall describe.
3. A set of productions, where each production consists of a nonterminal, called the head
or left sideoftheproduction,anarrow,andasequenceofterminalsand1ornonterminals,called
thebodyorright sideof the production. The intuitive intent of a production is to specify one of
the written forms of a construct; if the head nonterminal represents a construct, then the
bodyrepresents a written form of the construct.
4. A designation ofone of the nonterminalsas thestartsymbol.
Production is for a nonterminal if the nonterminal is the head of the production. A string of
terminalsisasequenceofzeroormoreterminals.Thestringofzeroterminals,writtenas E,iscalled the empty
string.

Derivations
A grammar derives strings by beginning with the start symbol and repeatedly replacing a nonterminal
bythebodyofaproductionforthatnonterminal.Theterminalstringsthatcanbederivedfromthestart symbol
form the language defined by the grammar.

LeftmostandRightmostDerivationofa String

 Leftmostderivation−Aleftmostderivationisobtainedbyapplyingproductiontotheleftmost
variableineachstep.
 Rightmostderivation −Arightmostderivationisobtainedbyapplyingproductiontothe rightmost
variable in each step.
 Example
Letanysetofproduction rulesinaCFG be
X→ X+X |X*X |X|a
overanalphabet{a}.
Theleftmost derivation for thestring"a+a*a"is
X→ X+X→ a+X → a+X*X→a+a*X→a+a*a
Therightmost derivation for theabovestring"a+a*a"is
X→ X*X→X*a→X+X*a→ X+a*a→ a+a*a

DerivationorYield ofaTree
The derivation or the yield of a parse tree is the final string obtained by concatenating the labels of the

49
leaves ofthetree from leftto right, ignoring theNulls. However,if all theleaves areNull, derivation is
Null.
parse tree pictorially shows how the start symbol of a grammar derives a string in the language. If
nonterminal A has a production AXYZ , then a parse tree may have an interior node labeled Awith
three children labeled X, Y, and Z, from left to right:

Givenacontext-freegrammar,aparsetreeaccordingtothegrammarisatreewiththefollowing properties:
1. Theroot islabeled bythestart symbol.
2. Eachleafislabeledby a terminalorbye.
3. Eachinteriornodeislabeled by a nonterminal

SET-4 KEY :

1) Input Buffering in Compiler Design

The lexical analyzer scans the input from left to right one character at a time. It uses two pointers begin
ptr(bp) and forward to keep track of the pointer of the input scanned.

50
Initially both the pointers point to the first character of the input string as shown below

The forward ptr moves ahead to search for end of lexeme. As soon as the blank space is encountered, it
indicates end of lexeme. In above example as soon as ptr (fp) encounters a blank space the lexeme “int” is
identified. The fp will be moved ahead at white space, when fp encounters white space, it ignore and
moves ahead.

then both the begin ptr(bp) and forward ptr(fp) are set at next token. The input character is thus read from
secondary storage, but reading in this way from secondary storage is costly. hence buffering technique is
used.A block of data is first read into a buffer, and then second by lexical analyzer.

there are two methods used in this context: One Buffer Scheme, and Two Buffer Scheme.

51
Weak and advanced learners Identification

Course Name:Compiler Design Branch: CSE


Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25

Process:
 Got the results of 3-1 semester.

 Identified the students who got failed in 3-1 sem results–Weak learners.

 Identify the students who got greater than 70 %marks–Advancedlearners

Faculty signature

52
Course Name:Compiler Design Regulation:R20
Year – Sem: III – II Academic Year:2024-25
Branch: CSE

Weak learners identified before commencement of class work from result analysis III-I.
Students who got failed in the 3-1 semester exams.

S.NO ROLL NO GRADE


1 226W1A0504 F
2 226W1A0510 F
3 226W1A0522 F
4 226W1A0526 F
5 226W1A0532 F
6 226W1A0532 F
7 226W1A0536 F
8 226W1A0544 F
9 226W1A0548 F
10 226W1A0550 F
11 226W1A0559 F
12 226W1A0572 F
13 226W1A0592 F
14 226W1A0596 F
15 226W1A0598 F
16 226W1A05A1 F
17 226W1A05A1 F
18 226W1A05A2 F
19 226W1A05A2 F
20 226W1A05A6 F
21 226W1A05A9 F
22 226W1A05B0 F

Facultysignature

53
Result Analysis to Identify advanced learners

Course Name:Compiler Design Branch: CSE


Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25

S.NO ROLL NO NAME


1 226W1A0501 ANTHARVEDI PALEM SIRISHA
2 226W1A0509 CHIRIKI ANISHMA
3 226W1A0521 KAKILETI DIVYASRI
4 226W1A0529 KOLLI PAVANI
5 226W1A0534 MANDAPALLI SUGUNA SRI LASYA
6 226W1A0551 SHEIK HASINA BIBI
7 226W1A0552 SUNKARA GANGA PRASANNA
8 226W1A0562 YEDULLA LIKHITHA
9 226W1A0566 BAKKA.LAKSHMI PRASANNA
10 226W1A0570 CHAGANTI SWATHI SATYA SRI
11 226W1A0574 GALLA CHARAN DEEPIKA
12 226W1A0575 JYOTHULA KEERTHI
13 226W1A0580 KANDUKURI SUMA SRI
14 226W1A0582 KETHA SRAVANTHI
15 226W1A0584 KONIJETI.DHAKSHAYANI
16 226W1A0588 MAJETI LAKSHMI SRUJANA
17 226W1A0590 MANNEPUDI BHUVANESWARI
18 226W1A0595 NARUKURTHI LAKSHMI MADHURI
19 226W1A0597 PANTHAM RAMYA
20 226W1A05A7 TIRUMALA BALA SATYA SREE

 Note: These students are instructed and guided to solve previous GATE EXAM
questions from Compiler Design.

 Advanced learners identified after III-I sem results-who got more than 70%
percentage.

FacultySignature

54
Date:08-02-2025

Circular

RemedialclassesforIIIB.TechISemCSE-1studentsforCompilerDesigncourse is scheduled
from 4:00 P.M – 5.00 P.M as follows .The students whoarein thelistshould attend
theclasses without failotherwiseaction will be taken.

The dates of remedial classes and listofstudents are senclosed:

Remedial ClassNo.
1 2 3 4

CSE 10-02--2025 17-02-2025 21-02-2025 25-02-2025

S.NO ROLL NO 3-1 Sem Results


1 226W1A0504 F
2 226W1A0510 F
3 226W1A0522 F
4 226W1A0526 F
5 226W1A0532 F
6 226W1A0532 F
7 226W1A0536 F
8 226W1A0544 F
9 226W1A0548 F
10 226W1A0550 F
11 226W1A0559 F
12 226W1A0572 F
13 226W1A0592 F
14 226W1A0596 F
15 226W1A0598 F
16 226W1A05A1 F
17 226W1A05A1 F
18 226W1A05A2 F
19 226W1A05A2 F
20 226W1A05A6 F

Copy to: Class Room


ClassIncharge HOD
Faculty

55
PLAN FOR REMEDIAL CLASS FOR WEAK STUDENTS

Course Name:Compiler Design Branch: CSE


Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25

Sno Section WorkPlanned


Date
CSE
Doubts clarification
1 10-02--2025 RegardingUnit-1

CSE
Doubts clarification
2 17-02-2025 RegardingUnit-2

CSE
Doubts clarification
3 21-02-2025 RegardingUnit-3

CSE
Doubts clarification
4 25-02-2025 RegardingUnit -4,5

FacultySignature

56
Course Name:Compiler Design Branch: CSE
Regulation:R20 Year – Sem: III – II
Academic Year: 2024-25

REMEDIAL ATTENDANCE SHEET

RollNo
S.No 10-02--2025 17-02-2025 21-02-2025 25-02-2025
CSE
226W1A0504
1 P P P A
226W1A0510
2 P P P P
226W1A0522
3 A P A P
226W1A0526
4 P A P A
226W1A0532
5 A P P P
226W1A0532
6 P A A P
226W1A0536
7 A P A P
226W1A0544
8 P P P A
9 226W1A0548
P P P A
10 226W1A0550
P P P P
11 226W1A0559
A P A P
12 226W1A0572
P A P A
13 226W1A0592
A P P P
14 226W1A0596
P A A P
15 226W1A0598
A P A P
16 226W1A05A1
P P P A
17 226W1A05A1
A P A P
18 226W1A05A2
P P P A
19 226W1A05A2
P P P A
20 226W1A05A6
P P P P

FacultySignature

57
58
COMPILER DESIGN PREVIOUS QUESTION PAPERS

59
60
61
62
63
64
Web References
W1 202.113.80.118:8080/sjjg/upLoad/down/.../20120704005.doc

W2 baggins.nottingham.edu.my/~hsooihock/G52CMP/semantic.ppt

W3 books.google.co.in/books?isbn=8131707881

W4 books.google.co.in › Computers › Programming › Algorithms

W5 digitallibrary.srmuniv.ac.in/dspace/bitstream/.../l/3259.pdf ...

65
COMPILER DESIGN MCQs
BRANCH:CSE SEM:3-2
Question:1
Acompilerwhichallowsonlythemodifiedsectionofthesourcecodetoberecompiledis called

(A) Subjectivecompiler

(B) Dynamiccompiler

(C) Re-configurablecompiler
(D) Incremental compiler
Ans:D
Question: 2
Acompilerispreferabletoaninterpreterbecause

(A) Debuggingcanbefasterandeasier

(B) Ifonechangesastatement,onlythatstatementneedsre-compilation

(C) Itismuchhelpfulintheinitialstagesofprogramdevelopment

(D) Itcangeneratestandaloneprogramsthatoftentakelesstimeforexec
utionAns: D
Question:3
Whichofthefollowingsymboltableimplementationhastheminimumaccesstime?

(A) Self-organizinglist

(B) Linear

(C) Searchtree

(D) Hash
table
Ans: D

Question:4

66
Atop-downparsergenerates

(A) Left-mostderivationinreverse

(B) Left-mostderivation

(C) Right-mostderivationinreverse

(D) Right –most


derivationAns: B
Question:5
Which of the following parsers is the most powerful?

(A) SLR

(B) LALR

(C) CanonicalLR

(D) Operator-
precedence Ans: C

Question:6
Which table is a permanent database that has an entry for each terminal symbol?

(A) Reductions

(B) Identifiertable

(C) Literaltable

(D) Terminal
table Ans: D

Question:7
Theactionofparsingthesourceprogramintopropersyntacticclassesiscalled

67
(A) Generalsyntaxanalysis

(B) Interpretationanalysis

(C) Syntaxanalysis

(D) Lexical
analysis Ans: D

Q8.Abottom-upparsergenerates

(A) Left-mostderivationinreverse

(B) Left-mostderivation

(C) Right-mostderivationinreverse

(D) Right –most


derivationAns: C

Question:9
Thebottom-upparsingmethodisalsocalled

(A) Shiftreduceparsing

(B) Predictiveparsing

(C) Recursivedescentparsing

(D) None of
these Ans: A

Question:10
Themethodwhichmergesthebodiesoftwoloopsis

(A) Constantfolding

68
(B) Loopjamming

(C) Loopunrolling

(D) None of
these Ans: B

Question:11
Synthesizedattributecanbeeasilysimulatedbya

(A) LRgrammar

(B) LLgrammar

(C) Ambiguousgrammar

(D) None of
these Ans: A

Question:12
Thetop-downparsingmethodisalsocalled

(A) Operatorprecedenceparsing

(B) Recursivedescentparsing

(C) Shiftreduceparsing

(D) None of these

Ans: B

Question:13
Which ofthe following techniques isusedto replace run-time computations by compile time
computations?

(A) Constantfolding

69
(B) Codehoisting

(C) Peepholeoptimization

(D) Invariant

computation Ans: A

Question:14
The most general phase structured grammar

(A) Contextsensitive

(B) Contextfree

(C) Regular
(D) None of these

Ans: A

Question:15

Which of the following class of statement usually produces no executable


code when compiled?

(A) Assignmentstatement

(B) Structuralstatements

(C) Inputandoutputstatements

(D) Declaratio

n Ans: B

Question:16
Thelexicalanalyzertakes asinputandproducesalistof
ofoutput.

(A) Machinecode,mnemonic

70
(B) Tokens,sourcecode

(C) Sourcecode,tokens

(D) Both a and b

Ans: C

Question:17
Linearanalysisiscalled inacompiler.

(A) Lexicalanalysis

(B) Scanning

(C) Testing

(D) Both a and b

Ans: D
Question:18
Lexicalanalysisisaboutbreakingasequenceofcharactersinto
Tokens

(A) Lines

(B) Groups

(C) Packets

Ans: A

Question:19
ThephaseSyntaxAnalysisismodeledonthebasisof

(A) Highlevellanguage

(B) Lowlevellanguage

(C) Contextfreegrammar

71
(D) Regular grammar

Ans: C
Question:20
Compilerisaprogramthat

(A) Acceptsaprogramwritteninahighlevellanguageandproducesanobjectprogram

(B) Appearstoexecuteasourceprogramasifitweremachinelanguage

(C) Automatesthetranslationofassemblylanguageintomachinelanguage

(D) Places programs into memory and prepares themfor

executionAns: A

Question:21
Anoptimizingcompiler

(A) Isoptimizedtooccupylessspace

(B) Optimizedthecode

(C) Isoptimizedtotakelesstimeforexecution

(D) None of these

Ans: B

Question:22
A compiler forahighlevel language thatrunsonone machine
andproducecodefordifferentmachineiscalled

(A) Onepasscompiler

(B) multipasscompiler

(C) crooscompiler

(D) optimizing

72
compiler Ans: C

Question:23
The graph that shows the basic blocks and their successorrelationship is called

(A) Hamiltoniangraph

(B) Controlgraph

(C) Flowgraph

(D) DAG
Ans:C

Question:24
constructs the desired target program from the intermediate
representation of the source program.

(A) Analysispart

(B) Lexicalpart

(C) Synthesispart

(D) None of these

Ans: C

Question:25
Whatisthe name ofthe process that determining whether of tokens canbe
generated bya grammar?

(A) Analysing

(B) Parsing
(C) Translating

73
(D) Recognizing

Ans: B

Question:26
grammarsarenotphasestructuredgrammar.

(A) Regular

(B) Contextfree

(C) Contextsensitive

(D) None of these

Ans: D

Question:27
Theparsingtechniquethatavoidsbacktrackingis

(A) Top-downparsing

(B) Recursive-descentparsing

(C) Predictiveparsing

(D) Both (b) and (c)

Ans: D
Question:28
CSG(COntextSensitiveGrammar)canberecognizedby

(A) Pushdownautomata

(B) Finitestateautomata

(C) 2-waylinearboundedautomata

(D) All of the above

Ans: C

Question:29
74
Which of the following symbol table implementation is based onthe property
of locality of reference?
(A) Linearlist

(B) Self-organizinglist

(C) Searchtree

(D) Hash table

Ans: B

Question:30
The process of searching for matched tokens is typically
described using

(A) Finiteautomata

(B) Regularexpressions

(C) Contextfreegrammar

(D) Both a and b

Ans: D

Question:31
Loaderisaprogramthat

(A) Placesprogramsintomemoryandpreparesthemforexecution

(B) Automatesthetranslationofassemblylanguageintomachinelanguage

(C) Acceptsaprogramwritteninahighlevellanguageandproducesanobjectprogram

(D) Appearsto execute asource program asifitwere machine language

Ans: A

75
Question:32
Interpreterispreferredoveracompileris

(A) Duringprogramdevelopmentphase

(B) Whenstoragespaceistobeminimized

(C) Whenefficientuseofcomputerresourcesistheconsideration

(D) All of these

Ans: A

Question:33
Which ofthe following isusedfor grouping of characters into tokens?

(A) Scanner

(B) Codegenerator

(C) Codeoptimizer

(D) Parser

Ans: A

Question:34
Typecheckingisnormallydoneduring

(A) Codeoptimization

(B) Syntaxdirectedtranslation

(C) Lexicalanalysis

(D) Syntax analysis

Ans: B

Question:35
Back-patchingisusefulforhandling

76
(A) Forwardreferences

(B) Backwardreferences

(C) Conditionaljumps

(D) Unconditional

jumps Ans: A

Question:36
isconsideredasasequenceofcharactersinatoken.

(A) Pattern

(B) Texeme

(C) Lexeme

(D) Mexeme

Question:37
or scanning is the process, where the stream of
charactersmakingupthesourceprogramisreadfromlefttorightand grouped into
tokens.

(A) Modeling

(B) Diversion

(C) Lexicalanalysis

(D) All of these

Ans: C
Question:38
LRstands for

(A) Left to right


77
(B) Left to rightreduction

(C) Right to left

(D) Lefttorightandrightmostderivationinreverse

Ans: D

Question:39
Recursivedescentparsingbelongstotheclassof

(A) Top-downparsing

(B) Bottom-upparsing

(C) Predictiveparsing

(D) None of these

Ans: A

Question:40
The graph depicting the inter-dependencies of the attribute ofdifferent nodes in a parse
is called

(A) Dependencygraph

(B) Karnaugh’sgraph

(C) Steffigraph

(D) Flow graph

Ans: C
Question:41
Compiler should report the presence of in the source
program, in translation process.

(A) Text

78
(B) Errors

(C) Classes

(D) Objects

Ans: B

Question:42
A basic block can be analyzed by

(A) Graphwithcycles

(B) DAG

(C) Flowgraph

(D) Noneofthese

Ans: B

Question:43
Minimum hamming distance method isused for connection of

(A) Algorithm errors

(B) Transcription errors

(C) Semantic errors


(D) Syntactic errors

Ans: D

Question:44
Theoutputoflexicalanalyzeris

(A) Stringsofcharacters

(B) Asetoftokens

(C) Syntaxtree

79
(D) A set of regular expressions

Ans: B

Question:45
Symboltablecanbeusedfor

(A) Storageallocation

(B) Checkingtypecompatibility

(C) Suppressingduplicationoferrormessages

(D) All of these

Ans: D

Question:46
compilercancheck error.

(A) syntax

(B) logical

(C) content

(D) Both a and b

Ans: A

Question:47
Whichofthefollowingislanguageprocessor?

(A) Interpreters

(B) Assembler
(C) Compilers

80
(D) All of these

Ans: D

Question:48
CFG(ContextFreeGrammar)canberecognizedbya

(A) Pushdownautomata

(B) Finitestateautomata

(C) 2waylinearboundedautomata

(D) Both a and c

Ans: D

Question:49
Handlepruningisthetechniqueusedtoobtain

(A) Canonicalreductionsequence

(B) Canonicalderivationsequence

(C) Both(a)and(b)

(D) None of these

Ans: A

Question:50
Semanticerrorscanbedetectedat

(A) Compiletimeonly

(B) Run-timeonly

(C) Both(a)and(b)

81
(D) None of these

Ans: C

Question:51
Apermanentdatabaseinthegeneralmodelofcompileris

(A) Sourcecode
(B) Terminaltable

(C) Identifiertable

(D) Literal

table Ans: B

Question:52
Which of the following actions an operator-precedence parser
maytaketorecoverfromanerror?

(A) Insertsymbolsontothestack

(B) Deletesymbolsfromthestack

(C) Insertordeletesymbolsfromtheinput

(D) All of these

Ans: D

Question:53
Which of the following system software resides in main memoryalways?

(A) Texteditor

(B) Assembler

(C) Linker

(D) All of these


82
Ans: D

Question:54
Leftfactoring is the process of factoring out the common

(A) Prefixesofalternates

(B) Suffixesofalternates

(C) Both(a)and(b)

(D) None of these

Ans: A

Question:55
is/arepartsofthecompiler.

(A) Executionpart

(B) Analysispart

(C) Synthesispart

(D) Both B and C

Ans: D

Question:56
How many parts of compiler are there?

(A) 2

(B) 4

(C) 6

(D) 8
Ans:A

83
Question:57
Which of the following is/arethephasesofcompiler?

(A) Codegeneration

(B) Syntaxanalyser

(C) Lexicalanalyser

(D) All of these

Ans: D

Question:58
Compilertranslatesthesourcecodeto

(A) Machinecode

(B) Executablecode

(C) Binarycode

(D) BothAandC
Ans:D

Question:59
Grammar of the programming is checked at phaseof
compiler.

(A) Syntaxanalysis

(B) Semanticanalysis

(C) Codegeneration

(D) Code optimization

Ans: A

84
Question:60
Whichofthefollowinggroupsis/aretokentogetherintosyntactic structures?

(A) Syntaxanalyzer

(B) Semanticanalyzer

(C) Lexicalanalyzer

(D) Intermediatecodegeneration
Ans:C

Question:61
What is a compiler?

(A) Acompileriscalculatingdevicewhichisprovidingveryefficientexecution

(B) Acompilerisageneralpurposelanguageprovidingveryefficientexecution

(C) Acompilerconvertsthewholeofahigherlevelprogramcodeintomachinecodein one step

(D) Acompilerdoesaconversionlinebylineastheprogramisrun Ans: C

Question:62
Only OS independent compiler is

(A) Javacompiler
(B) Visualbasiccompiler
(C) Pascalcompiler
(D) Turbo C

compiler Ans: A

Question:63
The phase ‘Semantic Analysis’ is responsible for in
Compiler.

85
(A) Checksemantics

(B) Staticchecking

(C) Typechecking

(D) All of these

Ans: D

Question:64
Theerrorsthatcanbepointedoutbythecompilerareknownas

(A) Internalerrors

(B) Logicalerrors

(C) Semanticerrors

(D) Syntax errors

Ans: D

Question:65
What do you call the translator which takes assembly language program as input & produce
machine languagecodeasoutput?

(A) Assembler
(B) Compiler
(C) Debugger
(D) Interpreter

Ans: A

Question:66
Which ofthe following cannot beusedasan intermediate code form?

(A) Quadruples
(B) Syntaxtrees
(C) Threeaddresscodes
(D) Post fix notation

Ans: A

86
Question:67
Whichofthefollowingcanbeusedtoidentifyloops?

(A) Dominators
(B) Reduciblegraphs
(C) Depthfirstordering
(D) All of these

Ans: D

Question:68
Thecostofdevelopingacompilerisproportionalto

(A) Flexibilityoftheavailableinstructionset

(B) Complexityofthearchitectureofthetargetmachine

(C) Complexityofthesourcelanguage

(D) All of these

Ans: D

Question:69
Replacement of an expensive operation by a cheaper one iscalled

(A) Reductioninstrength

(B) Loop-invariantcomputation

(C) Codemotion

(D) None of these

Ans: A

87
Question:70

Which of the following is not a sourceoferror?

(A) Faultydesignspecification

(B) Faultyalgorithm

(C) Compilersthemselves

(D) None of these

Ans: D

Question:71
Programminglanguagescanbecategoriesas

(A) Assemblylanguage

(B) Highlevellanguage

(C) Machinelanguage

(D) All of these

Ans: D
Question:72
WhatisthemeaningofaCompiler?

(A) Namegiventothecomputeroperator

(B) Partofthedigitalmachinetostoreinformation

(C) OperatorofBooleanalgebra

(D) Translator to convert source program into object

codeAns: D
88
Question:73
Language used ina computer that is similar tothe languages of
humanandiseasytounderstand,isreferredas

(A) Sourcecode

(B) Machinelanguage

(C) High level language

Ans: D

Question:74
Whichamongthefollowingis/areinterpretedlanguage?

(A) C++

(B) Java

(C) Visualbasic

(D) Both B and C

Ans: D

Question:75
What is a notation for writing programs, which are specificationsof a
computation or algorithm?

(A) Aprogramminglanguage

(B) Anoperatingsystem

(C) Hardware

(D) Web browser


89
Ans: A

Question:7
6
Whatisthe action of parsing the source program into proper syntatic
classes?

(A) Syntaxanalysis

(B) Lexicalanalyis

(C) Interpretationanalysis

(D) Generalsyntaxanalysis
Ans:B
Question:77
isaprocessoffindingaparsetreeforastringoftokens.

(A) Analysing

(B) Recognizing

(C) Parsing
(D) Tokenizing

Ans: C

Question:78
Representing the syntax by a grammar is advantageous. Whatis the cause?

(A) Itisconcise

(B) Itisaccurate

(C) Automationbecomeseasy

(D) All of the above

Ans: D

90
Question:79
A grammar thatproducesmorethanoneparsetreeforsome sentence is called as

(A) Ambiguous

(B) Regular

(C) Unambiguous

(D) All of these

Ans: A

Question:80
A isasoftwareutilitythattranslatescodewritteninhigher language into a
low level language.

(A) Converter

(B) Texteditor

(C) Code optimizer


Ans:A

Question:81
Which programming languages are classified as low level languages?

(A) BASIC,COBOL,FORTRAN

(B) Assemblylanguages

(C) KnowledgebasedSystems

(D) Prolog 2, Expert Systems

Ans: B

91
Question:82
A compiler translate high level programs into low
levelprograms, which is called as

(A) Betacode

(B) Compiledcode

(C) Sourcecode

(D) Object code

Ans: D

Question:83
Whatisaninterpreter?

(A) Aninterpreterisadecoderwhichprovidesveryefficientexecution

(B) Aninterpreterisageneralpurposelanguageprovidingveryefficientexecution

(C) Aninterpreterdoestheconversionlinebylineastheprogramisrun

(D) Aninterpreteristherepresentationofthesystembeingdesigned

Ans:D

Question:84
The translator program used in assembly language is called

(A) Assembler

(B) Interpreter

(C) Compiler

(D) Translator

Ans: A

92
Question: 85
A(n) languagereflectsthewaypeoplethinkmathematically.

(A) Functionalprogramming

(B) Crossplatformprogramming

(C) 3GLbusinessprogramming

(D) Eventdriven programming


Ans:A

93

You might also like