CSMC210 Compiler Design
CSMC210 Compiler Design
CSMC210 Compiler Design
COURSE OBJECTIVES:
To introduce the major concept areas of language translation and compiler design.
To enrich the knowledge in various phases of compiler and its use.
To provide practical programming skills necessary for constructing a compiler.
To demonstrate intermediate code using techniques of syntax directed translation.
To illustrate the various optimization techniques for designing various optimizing compilers.
COURSE CONTENT:
Unit-I Introduction to Compilers 8
Compilers – Analysis of the source program – Phases of a compiler – Cousins of the Compiler –
Grouping of Phases – Compiler construction tools – Lexical Analysis – Role of Lexical Analyzer
– Input Buffering – Specification of Tokens.
Unit-II Syntax Analysis 8
Role of the parser –Writing Grammars –Context-Free Grammars – Top Down parsing –
Recursive Descent Parsing – Predictive Parsing – Bottom-up parsing – Shift Reduce Parsing –
Operator Precedent Parsing – LR Parsers – SLR Parser – Canonical LR Parser – LALR Parser.
Unit-III Intermediate Code Generation 8
Intermediate languages – Declarations – Assignment Statements – Boolean Expressions –
Case Statements – Back patching – Procedure calls.
Unit-IV Code Optimization and Run Time Environment 8
Introduction– Principal Sources of Optimization – Optimization of basic Blocks – DAG
representation of Basic Blocks - Introduction to Global Data Flow Analysis – Runtime
Environments – Source Language issues – Storage Organization – Storage Allocation strategies –
Access to non-local names – Parameter Passing, Error detection and recovery.
Unit-V Code Generation 8
Issues in the design of code generator – The target machine – Runtime Storage management –
Basic Blocks and Flow Graphs – Next-use Information – A simple Code generator – Peephole
Optimization.
LIST OF EXPERIMENTS:
1. Study of Lex and YACC Tools.
2. To convert regular expression into NFA.
3. Write a lex program to scan reserved word & identifiers of C language.
4. Write a program to generate tokens for the given grammer.
5. Write a program to convert NFA to DFA.
6. Write a program for minimizing of DFA.
7. Implement Predictive Parsing algorithm
8. Write a C program to generate three address code.
9. Implement SLR(1) Parsing algorithm
10. Design LALR bottom up parser for the given language
11. Write a C program for constructing recursive descent parsing
Total Periods: 40 + 48 = 88
COURSE OUTCOMES:
After the completion of this course, students will be able to:
CO1 : Apply the knowledge of lex tool & YACC tool to develop a scanner & parser (K3)
CO2 : Construct Grammars for Natural Languages and find the Syntactical (K2)
Errors/Semantic errors during the compilations using parsing techniques.
CO3 : Analyze different representations of intermediate code. (K4)
CO4 : Understand runtime environment. (K3)
CO5 : Construct new compiler for new languages. (K3)
TEXT BOOKS:
1. Alfred V. Aho, Monica S. Lam, “Compilers: Principles, Techniques and Tools”, Pearson Education
Asia, Updated 2nd Edition, 2023.
2. O. G. Kakde, "Compiler Design", 4th Edition, Laxmi Publications, 2015.
REFERENCE BOOKS:
1. John I. Moore Jr., “Compiler Design using Java – An Object-Oriented Approach”, 3 rd Edition,
Softmoore Consulting Publisher, 2022.
2. C. N. Fischer and R. J. LeBlanc, “Crafting a compiler with C”, Benjamin Cummings, 2003.
CO to PO/PSO Mapping
PSO1
PSO2
PSO3
PO10
PO11
PO12
PO1
PO2
PO3
PO4
PO5
PO6
PO7
PO8
PO9
CO1 3 2 3 - 2 - - - - - - - 3 - -
CO2 3 2 3 - 2 - - - - - - - 3 - -
CO3 3 2 3 - 2 - - - - - - - 3 - -
CO4 2 - - 3 - - - - - - - - - - -
CO5 2 - - 3 - - - - - - - - - - -
Score 13 6 9 6 6 - - - - - - - 9 - -
COM 3 2 3 3 2 - - - - - - - 3 - -