PO1 | PO2 | PO3 | PO4 | PO5 | PO6 | PO7 | PO8 | PO9 | PO10 | PO11 | PO12 | PSO1 | PSO2 | PSO3 | ||
K3 | K6 | K6 | K6 | K6 | - | - | - | - | - | - | - | K6 | K5 | K6 | ||
CO1 | K3 | 3 | 2 | 2 | 2 | 2 | ||||||||||
CO2 | K3 | 3 | 2 | 2 | 2 | 2 | ||||||||||
CO3 | K3 | 3 | 2 | 2 | 2 | 2 | ||||||||||
CO4 | K3 | 3 | 2 | 2 | 2 | 2 | ||||||||||
CO5 | K3 | 3 | 2 | 2 | 2 | 2 | ||||||||||
Score | 15 | 10 | 10 | 10 | 10 | |||||||||||
Course Mapping | 3 | 2 | 2 | 2 | 2 |
{{{credits}}}
L | T | P | C |
3 | 0 | 2 | 4 |
- To learn various phases of a compiler
- To learn various parsing techniques
- To understand intermediate code generation
- To learn to implement code generator and optimize the code.
{{{unit}}}
UNIT I | INTRODUCTION TO COMPILERS | 9 |
Language processors – Phases of compiler – Role of lexical analyzer – Input buffering – Specification of tokens – Recognition of tokens; Lexical analyzer generator: Structure of lex program – Lookahead operator and conflict resolution.
{{{unit}}}
UNIT II | SYNTAX ANALYSIS | 9 |
Role of Parser – Writing grammars for language constructs – Types of
grammars: Ambiguity – Deterministic and recursive; Top down parsers:
Recursive descent parser – Predictive parser; Bottom up parsers: SLR
Parser – CLR Parser – LALR Parser; Error handling and recovery in
syntax analyzer; Syntax analyzer generator: Structure of yacc program
– Creating yacc
lexical analyzers with lex
.
{{{unit}}}
UNIT III | INTERMEDIATE CODE GENERATION | 9 |
Syntax directed definitions: Synthesized attribute – Inherited attribute – Dependency graph – Evaluation order of syntax directed definitions; Intermediate languages: Syntax tree – Three address code; SDD for type checking – Declarations – Evaluation of expressions and flow of control statements – Bottom-up evaluation of S-attribute definitions.
{{{unit}}}
UNIT IV | RUNTIME ENVIRONMENTS AND CODE GENERATION | 9 |
Source language issues – Storage organization – Storage allocation strategies: Static, Stack and Heap – Implementation of symbol table – Issues in code generation – Design of a simple code generator.
{{{unit}}}
UNIT V | CODE OPTIMIZATION | 9 |
Principal sources of optimization – DAG – Optimization of basic blocks – Global data flow analysis – Introduction to Low Level Virtual Machine (LLVM) – Design of LLVM – Core libraries – Developing plugin in LLVM.
\hfill Theory Periods: 45
- Implementation of Lexical Analyzer using Lex Tool
- Implementation of Arithmetic Calculator using LEX and YACC
- Generation of TAC for a simple program using LEX and YACC
- Consider a simple program as an input and process this code to print the intermediate code after every phase. It is necessary to print the output of lexical, syntax, semantic, intermediate code generation, code optimization and code generation phases
- Study of LLVM framework.
\hfill Practical Periods: 30
\hfill Total Periods: 75
After the completion of this course, students will be able to:
- Design a lexical analyzer for a sample language (K3)
- Apply different parsing algorithms to develop the parsers for the given grammar (K3)
- Write syntax directed translation for programming language constructs (K3)
- Understand and implement a simple code generator (K3)
- Understand and implement code optimization techniques (K3).
- Alfred V Aho, Monica S Lam, Ravi Sethi, Jeffrey D. Ullman, “Compilers: Principles, Techniques and Tools”, 2nd Edition, Pearson Education, 2009.
- Rafael Auler, Bruno Cardoso Lopes, “Getting Started with LLVM Core Libraries”, Packt Publishing, 2014.
- Randy Allen, Ken Kennedy, “Optimizing Compilers for Modern Architectures: A Dependence Based Approach”, Morgan Kaufmann Publishers, 2002.
- Steven S. Muchnick, “Advanced Compiler Design and Implementation”, Morgan Kaufmann Publishers - Elsevier Science, India, Indian Reprint 2003.
- Keith D Cooper, Linda Torczon, “Engineering a Compiler”, Morgan Kaufmann Publishers Elsevier Science, 2004.
- Andrew W. Appel, “Modern Compiler Implementation in C”, Cambridge University Press, 1st edition, 2004.
- Watson, Des, “A Practical Approach to Compiler Construction”, 1st edition, Springer-Verlog, 2017.