Handout
Handout
K L Deemed to be University
Department of Computer Science and Engineering-Honors -- KLVZA
Course Handout
2023-2024, Even Sem
Course Title :COMPILER DESIGN
Course Code :21CS3204A
L-T-P-S Structure : 3-0-4-0
Pre-requisite :
Credits :5
Course Coordinator :KAVITHA SARIHADDU
Team of Instructors :
Teaching Associates :
Syllabus :Module 1: INTRODUCTION TO COMPILERS: Definition of compiler, interpreter and its differences, the phases of a compiler, role of lexical
analyzer, regular expressions, finite automata, from regular expressions to finite automata, pass and phases of translation, bootstrapping, LEX-lexical analyzer
generator, Symbol Table Manager, Error Handler. Module 2: PARSING: Parsing, role of parser, context free grammar, derivations, parse trees, ambiguity,
elimination of left recursion, left factoring, eliminating ambiguity from dangling-else grammar, classes of parsing, top down parsing - backtracking, recursive
descent parsing, predictive parsers, LL(1) grammars. BOTTOM UP PARSING: Definition of bottom up parsing, handles, handle pruning, stack implementation
of shift-reduce parsing, conflicts during shift-reduce parsing, LR grammars, LR parsers-simple LR, canonical LR(CLR) and Look Ahead LR (LALR) parsers,
YACC-Automatic Parser Generator. Module 3: SYNTAX DIRECTED TRANSLATION: Syntax directed definition, construction of syntax trees, S attributed
and L-attributed definitions, translation schemes, emitting a translation. INTERMEDIATE CODE GENERATION: intermediate forms of source programs–
abstract syntax tree, polish notation and three address code, types of three address statements and its implementation, syntax directed translation into three-
address code, translation of simple statements, Boolean expressions and flow-of-control statements, Storage Organization, Stack Allocation Space, Access to
Non-local Data on the Stack, Heap Management — Issues in Code Generation Module 4: CODE OPTIMIZATION: Organization of code optimizer, basic
blocks and flow graphs, optimization of basic blocks, the principal sources of optimization, the directed acyclic graph (DAG) representation of basic block,
global data flow analysis. CODE GENERATION: Machine dependent code generation, object code forms, the target machine, a simple code generator, register
allocation and assignment, peephole optimization, Loop optimization. Module 5: Symbol Table Manager, Error Handler, RUN-TIME ENVIRONMENT AND
CODE GENERATION, loop optimization.
Text Books :1. Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, Compilers: Principles, Techniques and Tools‖, Second Edition, Pearson
Education, 2009. 2. Allen I. Holub, Compiler Design in C‖, Prentice-Hall Software Series, 1993
Reference Books :1. Keith D Cooper and Linda Torczon, Engineering a Compiler‖, Morgan Kaufmann Publishers Elsevier Science, 2004 2. Steven S.
Muchnick, Advanced Compiler Design and Implementation‖, Morgan Kaufmann Publishers - Elsevier Science, India, Indian Reprint 2003
Web Links :https://nptel.ac.in/courses/106104123-Compiler Design, IIT Kanpur-Prof. Sanjeev K Aggarwal
about:blank 1/32
1/13/24, 3:52 PM about:blank
Course Rationale :Compiler Design is a course that introduces students to some basics in the design and implementation of compilers. This course covers the
theory behind various components of a compiler such as Lexical Analyzer, Syntax and Semantic Analyzer, Intermediate code generator, Code optimization and
Code generation and also the programming techniques involved to put the theory into practice, and the interfaces used to modularize the compiler.
Blooms
CO Taxonomy
Course Outcome (CO) PO/PSO
NO Level
(BTL)
CO1 Design lexical analyzers for corresponding regular expressions PSO1,PO1,PO2 3
CO2 Design efficient parsers for a given context free grammar PSO1,PO2,PO3 3
CO3 Design intermediate code generator PSO1,PO1,PO2,PO3 3
CO4 RUN-TIME ENVIRONMENT TECHNIQUES PO1,PO2,PSO1 3
CO5 Apply code optimization techniques and apply them to generate efficient code. PSO1,PO1,PO2,PO3 3
CO6 Design a simple compiler using LeX and YACC PO5,PSO2,PO3 3
Outcome Highest
COI-2 COI-3
No. BTL
Btl-2 Btl-3
CO1 3 Understand the introduction of compilers and its phases, Understand
Apply the concepts of pass and phases of translation, bootstrapping,
Finite Automata, Regular Expressions and its conversions and LEX-lexical analyzer generator.
Btl-2 Btl-3
Undersatnding the concepts of removing ambiguity from dangling
Applying the concepts of removing ambiguity from dangling else
CO2 3
else grammar, Top-Down Parsing, Appling the Concepts of Bottom-
grammar, Top-Down Parsing, Appling the Concepts of Bottom-Up
Up Parsing Parsing
Btl-3
Btl-2 Applying the concepts of INTERMEDIATE CODE GENERATION
CO3 3 Understanding the Concepts of SYNTAX DIRECTED and types of three address statements, Applying the Concepts of
TRANSLATION syntax directed translation into three-address code and flow-of-
control statements.
CO4 3 Btl-2 Btl-3
Understand the Concepts of RUN-TIME ENVIRONMENT: Storage Applying the Concepts of the Access to Non-local Data on the Stack
about:blank 2/32
1/13/24, 3:52 PM about:blank
Organization and Stack Allocation Space and Heap Management — Issues in Code Generation
Btl-2 Btl-3
CO5 3 Understand the Concepts of basic blocks and flow graphs, Applying the Concepts of the principal sources of optimization and
optimization of basic blocks, DAG, Applying the Concepts of CODE GENERATION
Btl-3
CO6 3
Design the solution for real world problems using c
Po
Program Outcome
No.
Engineering Knowledge:Apply the knowledge of mathematics, science, engineering fundamentals, and an engineering specialization to the solution of
PO1
complex engineering problems.
Problem Analysis: Identify, formulate, review research literature, and analyse complex engineering problems reaching substantiated conclusions using
PO2
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
PO3
specified needs 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 research methods including design of experiments, analysis and
PO4 interpretation of data, and synthesis of the information to provide valid conclusions for complex problems that cannot be solved by straightforward
application of knowledge, theories and techniques applicable to the engineering discipline.
Modern Tool Usage:Create, select, and apply appropriate techniques, resources, and modern engineering and IT tools including prediction and
PO5
modelling to complex engineering activities with an understanding of the limitations.
The Engineer and Society:Apply reasoning informed by the contextual knowledge to assess societal, health, safety, legal and cultural issues and the
PO6
consequent responsibilities relevant to the professional engineering practice.
Environment and Sustainability:Understand the impact of the professional engineering solutions in societal and environmental contexts, and
PO7
demonstrate the knowledge of, and need for sustainable development
PO8 Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the engineering practice
PO9 Individual and Team Work: Function effectively as an individual, and as a member 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
PO10
able to comprehend and write effective reports and design documentation, make effective presentations, and give and receive clear instructions
Project Management and Finance: Demonstrate knowledge and understanding of the engineering and management principles and apply these to one’s
PO11
own work, as a member and leader in a team, to manage projects and in multidisciplinary environments.
Life-long Learning: Recognize the need for, and have the preparation and ability to engage in independent and lifelong learning in the broadest context
PO12
of technological change.
about:blank 3/32
1/13/24, 3:52 PM about:blank
PSO1 An ability to design and develop software projects as well as Analyze and test user requirements.
PSO2 An Ability to gain working Knowledge on emerging software tools and technologies.
COI- from regular expressions to finite automata, pass and ALM,End Semester Exam,SEM-
4 CO1 [90] Chalk,PPT,Talk
3 phases of translation EXAM1
COI-
5 CO1 bootstrapping, LEX-lexical analyzer generator [101] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
2
COI-
6 CO1 Symbol Table Manager, Error Handler [159] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
2
COI-
7 CO2 Parsing, role of parser [175] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
2
COI-
8 CO2 context-free grammar, derivations [184] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
2
COI-
9 CO2 parse trees, ambiguity, [190] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
2
10 CO2 COI- elimination of left recursion, left factoring, eliminating [198] Chalk,PPT,Talk ALM,End Semester
about:blank 4/32
1/13/24, 3:52 PM about:blank
Teaching-
Book No[CH No][Page
Sess.No. CO COI Topic Learning EvaluationComponents
No]
Methods
2 ambiguity from dangling-else grammar, Exam,HA,SEM-EXAM1
COI-
12 CO2 predictive parsers, LL(1) grammars [202] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
2
COI-
14 CO2 stack implementation of shift-reduce parsing [232] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
3
COI-
15 CO2 conflicts during shift-reduce parsing, [279] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
2
COI-
16 CO2 LR grammars, LR parsers-simple LR [290] Chalk,PPT,Talk End Semester Exam,SEM-EXAM1
3
COI-
19 CO3 S-attributed and L-attributed definitions [232] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
2
COI-
20 CO3 translation schemes, emitting a translation [232] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
2
21 CO3 COI- INTERMEDIATE CODE GENERATION: intermediate [279] Chalk,PPT,Talk ALM,End Semester
about:blank 5/32
1/13/24, 3:52 PM about:blank
Teaching-
Book No[CH No][Page
Sess.No. CO COI Topic Learning EvaluationComponents
No]
Methods
3 forms of source programs– abstract syntax tree Exam,HA,SEM-EXAM2
COI-
22 CO3 Polish notation and three address code [] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
2
COI-
23 CO3 types of three address statements and its implementation [296] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
2
COI-
25 CO3 Boolean expressions and flow-of-control statements [344] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
3
COI-
27 CO4 Storage Organization [410] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
2
COI-
29 CO4 Access to Non-local Data on the Stack [433] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
3
32 CO5 COI- basic blocks and flow graphs [586] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
about:blank 6/32
1/13/24, 3:52 PM about:blank
Teaching-
Book No[CH No][Page
Sess.No. CO COI Topic Learning EvaluationComponents
No]
Methods
2
COI-
33 CO5 optimization of basic blocks [586] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
3
COI-
34 CO5 the principal sources of optimization [623] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
2
COI- the directed acyclic graph (DAG) representation of the ALM,End Semester
35 CO5 [623] Chalk,PPT,Talk
3 basic block Exam,HA,SEM-EXAM2
COI-
36 CO5 global data flow analysis. CODE GENERATION [618] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
2
COI-
37 CO5 Machine-dependent code generation, object code forms [618] Chalk,PPT,Talk End Semester Exam,SEM-EXAM2
2
SESSION NUMBER : 1
Session Outcome: 1 INTRODUCTION TO COMPILERS: Definition of compiler, interpreter and its differences
about:blank 7/32
1/13/24, 3:52 PM about:blank
--- NOT
5 Attendence 1 Talk
APPLICABLE ---
--- NOT
20 INTRODUCTION TO COMPILERS: Definition of compiler, 2 PPT
APPLICABLE ---
--- NOT
20 interpreter and its differences 2 PPT
APPLICABLE ---
--- NOT
5 Conclusion and summary 2 Talk
APPLICABLE ---
SESSION NUMBER : 2
SESSION NUMBER : 3
about:blank 8/32
1/13/24, 3:52 PM about:blank
--- NOT
5 Conclusion and summary 2 Talk
APPLICABLE ---
SESSION NUMBER : 4
Session Outcome: 4 from regular expressions to finite automata, pass and phases of translation
SESSION NUMBER : 5
SESSION NUMBER : 6
about:blank 9/32
1/13/24, 3:52 PM about:blank
SESSION NUMBER : 7
SESSION NUMBER : 8
about:blank 10/32
1/13/24, 3:52 PM about:blank
--- NOT
20 derivations 2 PPT
APPLICABLE ---
--- NOT
5 conclusion and summary 2 Talk
APPLICABLE ---
SESSION NUMBER : 9
SESSION NUMBER : 10
Session Outcome: 4 elimination of left recursion, left factoring, eliminating ambiguity from dangling-else grammar,
SESSION NUMBER : 11
about:blank 11/32
1/13/24, 3:52 PM about:blank
Session Outcome: 5 classes of parsing, top down parsing - backtracking, recursive descent parsing
SESSION NUMBER : 12
SESSION NUMBER : 13
Session Outcome: 7 BOTTOM UP PARSING: Definition of bottom up parsing, handles, handle pruning,
about:blank 12/32
1/13/24, 3:52 PM about:blank
--- NOT
20 handle pruning 2 PPT
APPLICABLE ---
--- NOT
5 conclusion and summary 2 Talk
APPLICABLE ---
SESSION NUMBER : 14
SESSION NUMBER : 15
SESSION NUMBER : 16
about:blank 13/32
1/13/24, 3:52 PM about:blank
SESSION NUMBER : 17
Session Outcome: 1 canonical LR(CLR) and Look Ahead LR (LALR) parsers, YACC-Automatic Parser Generator
SESSION NUMBER : 18
Session Outcome: 1 SYNTAX DIRECTED TRANSLATION: Syntax directed definition, construction of syntax trees,
about:blank 14/32
1/13/24, 3:52 PM about:blank
--- NOT
20 SYNTAX DIRECTED TRANSLATION: Syntax directed definition 3 PPT
APPLICABLE ---
--- NOT
20 construction of syntax trees 3 PPT
APPLICABLE ---
--- NOT
5 conclusion and summary 3 Talk
APPLICABLE ---
SESSION NUMBER : 19
SESSION NUMBER : 20
about:blank 15/32
1/13/24, 3:52 PM about:blank
SESSION NUMBER : 21
Session Outcome: 1 INTERMEDIATE CODE GENERATION: intermediate forms of source programs– abstract syntax tree
SESSION NUMBER : 22
SESSION NUMBER : 23
about:blank 16/32
1/13/24, 3:52 PM about:blank
--- NOT
20 types of three address statements 2 PPT
APPLICABLE ---
--- NOT
20 its implementation 2 PPT
APPLICABLE ---
--- NOT
5 conclusion and summary 2 Talk
APPLICABLE ---
SESSION NUMBER : 24
Session Outcome: 1 syntax directed translation into three- address code, translation of simple statements
SESSION NUMBER : 25
about:blank 17/32
1/13/24, 3:52 PM about:blank
SESSION NUMBER : 26
SESSION NUMBER : 27
SESSION NUMBER : 28
about:blank 18/32
1/13/24, 3:52 PM about:blank
--- NOT
5 Attendence 1 Talk
APPLICABLE ---
20 Stack Allocation Space 3 PPT Quiz/Test Questions
20 Stack Allocation Space 3 PPT Quiz/Test Questions
--- NOT
5 conclusion and summary 3 Talk
APPLICABLE ---
SESSION NUMBER : 29
SESSION NUMBER : 30
about:blank 19/32
1/13/24, 3:52 PM about:blank
SESSION NUMBER : 31
SESSION NUMBER : 32
SESSION NUMBER : 33
about:blank 20/32
1/13/24, 3:52 PM about:blank
--- NOT
5 Attendence 1 Talk
APPLICABLE ---
--- NOT
20 optimization of basic blocks 3 PPT
APPLICABLE ---
--- NOT
20 optimization of basic blocks 3 PPT
APPLICABLE ---
--- NOT
5 conclusion and summary 3 Talk
APPLICABLE ---
SESSION NUMBER : 34
SESSION NUMBER : 35
Session Outcome: 1 the directed acyclic graph (DAG) representation of basic block
about:blank 21/32
1/13/24, 3:52 PM about:blank
SESSION NUMBER : 36
SESSION NUMBER : 37
SESSION NUMBER : 38
--- NOT
20 the target machine 2 PPT
APPLICABLE ---
--- NOT
20 a simple code generator 2 PPT
APPLICABLE ---
--- NOT
5 conclusion and summary 2 Talk
APPLICABLE ---
SESSION NUMBER : 39
Tutorial
Session Topics CO-Mapping
no
SESSION NUMBER : 1
about:blank 24/32
1/13/24, 3:52 PM about:blank
--- NOT
45 Elimination of white spaces and comments 3 PPT
APPLICABLE ---
SESSION NUMBER : 2
SESSION NUMBER : 3
SESSION NUMBER : 4
SESSION NUMBER : 5
about:blank 25/32
1/13/24, 3:52 PM about:blank
SESSION NUMBER : 6
SESSION NUMBER : 7
SESSION NUMBER : 8
about:blank 26/32
1/13/24, 3:52 PM about:blank
--- NOT
55 attedance, Inlab 1 Talk
APPLICABLE ---
--- NOT
45 Build Shift-Reduce parser 3 PPT
APPLICABLE ---
SESSION NUMBER : 9
SESSION NUMBER : 10
SESSION NUMBER : 11
about:blank 27/32
1/13/24, 3:52 PM about:blank
SESSION NUMBER : 12
Assignment
Week Assignment Type Topic Details co
No
Hour 1 2 3 4 5 6 7 8 9
Day Component
Theory V-S21 V-S21 --- --- --- --- --- --- ---
Tutorial -- -- --- --- --- --- --- --- ---
Mon
Lab V-S31,V-S31,V-S31 V-S31,V-S31,V-S31 --- --- --- --- --- --- ---
Skilling -- -- --- --- --- --- --- --- ---
Tue Theory -- -- -- -- -- -- -- -- --
Tutorial -- -- -- -- -- -- -- -- --
Lab -- -- -- -- -- -- -- -- --
about:blank 28/32
1/13/24, 3:52 PM about:blank
Skilling -- -- -- -- -- -- -- -- --
Theory V-S11,V-S31 V-S11,V-S31 --- --- --- --- --- --- ---
Tutorial -- -- --- --- --- --- --- --- ---
Wed
Lab -- -- --- --- --- --- --- --- ---
Skilling -- -- --- --- --- --- --- --- ---
Theory -- -- -- -- -- -- -- -- --
Tutorial -- -- -- -- -- -- -- -- --
Thu
Lab -- -- -- -- -- -- -- -- --
Skilling -- -- -- -- -- -- -- -- --
Theory -- -- --- --- --- --- --- --- ---
Tutorial -- -- --- --- --- --- --- --- ---
Fri
Lab V-S11,V-S11,V-S11,V-S21,V-S21,V-S21 V-S11,V-S11,V-S11,V-S21,V-S21,V-S21 --- --- --- --- --- --- ---
Skilling -- -- --- --- --- --- --- --- ---
Theory -- -- -- -- -- -- -- -- --
Tutorial -- -- -- -- -- -- -- -- --
Sat
Lab -- -- -- -- -- -- -- -- --
Skilling -- -- -- -- -- -- -- -- --
Theory -- -- -- -- -- -- -- -- --
Tutorial -- -- -- -- -- -- -- -- --
Sun
Lab -- -- -- -- -- -- -- -- --
Skilling -- -- -- -- -- -- -- -- --
REMEDIAL CLASSES:
Supplement course handout, which may perhaps include special lectures and discussions that would be planned, and schedule notified according
SELF-LEARNING:
about:blank 29/32
1/13/24, 3:52 PM about:blank
DELIVERY DETAILS OF CONTENT BEYOND SYLLABUS:
Content beyond syllabus covered (if any) should be delivered to all students that would be planned, and schedule notified accordingly.
S.no Advanced Topics, Additional Reading, Research papers and any CO ALM References/MOOCS
EVALUATION PLAN:
Evaluation Type Evaluation Component Weightage/Marks Assessment Dates Duration (Hours) CO1 CO2 CO3 CO4 CO5 CO6
Weightage 25 5 5 5 5 5
End Semester Exam 120
End Semester Max Marks 100 20 20 20 20 20
Summative Weightage 10 10
Lab End Semester Exam 120
Evaluation Max Marks 50 50
Total= 40 % Weightage 5 5
Poster Presentation 15
Max Marks 50 50
Weightage 10 2 2 2 2 2
MOOCs Review 120
Max Marks 50 10 10 10 10 10
In Semester Weightage 5 1 1 1 1 1
ALM 30
Formative Max Marks 50 10 10 10 10 10
Evaluation Weightage 5 1 1 1 1 1
Total= 25 % Home Assignment and Textbook 30
Max Marks 50 10 10 10 10 10
Weightage 5 5
Continuous Evaluation - Lab Exercise 100
Max Marks 50 50
Weightage 15 7.5 7.5
Semester in Exam-I 90
In Semester Max Marks 50 25 25
Summative Weightage 15 5 5 5
Semester in Exam-II 90
Evaluation Max Marks 50 16 16 18
Total= 35 % Weightage 5 5
Lab In Semester Exam 120
Max Marks 50 50
ATTENDANCE POLICY:
about:blank 30/32
1/13/24, 3:52 PM about:blank
Every student is expected to be responsible for regularity of his/her attendance in class rooms and laboratories, to appear in scheduled tests and examinations
and fulfill all other tasks assigned to him/her in every course
In every course, student has to maintain a minimum of 85% attendance to be eligible for appearing in Semester end examination of the course, for cases of
medical issues and other unavoidable circumstances the students will be condoned if their attendance is between 75% to 85% in every course, subjected to
submission of medical certificates, medical case file and other needful documental proof to the concerned departments
DETENTION POLICY :
In any course, a student has to maintain a minimum of 85% attendance and In-Semester Examinations to be eligible for appearing to the Semester End
Examination, failing to fulfill these conditions will deem such student to have been detained in that course.
PLAGIARISM POLICY :
Supplement course handout, which may perhaps include special lectures and discussions
COURSE TEAM MEMBERS, CHAMBER CONSULTATION HOURS AND CHAMBER VENUE DETAILS:
Supplement course handout, which may perhaps include special lectures and discussions
Delivery Chamber
Sections of Chamber Chamber Consultation Signature of
Name of Faculty Component of Consultation Room
Faculty Consultation Day (s) Timings for each day Course faculty:
Faculty No:
Anjali Devi Swarna L 11-MA - - - -
Anjali Devi Swarna P 11-A - - - -
Tirandasu Kumar P 11-B - - - -
Altaf Karani P 21-C - - - -
Vuyyuru Reddy P 11-C - - - -
Amika Achom P 21-C - - - -
nuthakki praveena P 31-B - - - -
PUNYALA
L 21-MA - - - -
RAMADEVI
PUNYALA
P 21-A - - - -
RAMADEVI
KISHORE DASARI P 31-B - - - -
LAVANYA
P 21-B - - - -
KONGALA
about:blank 31/32
1/13/24, 3:52 PM about:blank
BALAKRISHNA
L 31-MA - - - -
BANGARU
BALAKRISHNA
P 31-A - - - -
BANGARU
Bhargavi Nalluri P 31-C - - - -
GENERAL INSTRUCTIONS
Students should come prepared for classes and carry the text book(s) or material(s) as prescribed by the Course Faculty to the class.
NOTICES
All notices concerning the course will be displayed on the respective Notice Boards.
(KAVITHA SARIHADDU)
Department Of CSE-Honors
HEAD OF DEPARTMENT:
about:blank 32/32