23CS1602 COMPILER DESIGN L T P C
3 0 2 4
COURSE OBJECTIVE:
To learn the various phases of compiler.
To learn the various parsing techniques.
To understand intermediate code generation and run-time environment.
To learn to implement front-end of the compiler.
To learn to implement code generator.
UNIT I INTRODUCTION TO COMPILERS & LEXICAL ANALYSIS 8
Introduction- Translators- Compilation and Interpretation- Language processors -The Phases of Compiler – Lexical Analysis – Role of Lexical Analyzer – Specification of Tokens – Recognition of Tokens – Finite Automata – Regular Expressions to Automata– Minimizing DFA - Language for Specifying Lexical Analyzers – Lex tool.
UNIT II SYNTAX ANALYSIS 11
Role of Parser – Grammars – Context-free grammars – Writing a grammar Top Down Parsing - General Strategies - Recursive Descent Parser Predictive ParserLL(1) - Parser-Shift Reduce Parser-LR Parser- LR (0)Item Construction of SLR Parsing Table - Introduction to LALR Parser - Error Handling and Recovery in Syntax Analyzer-YACC tool - Design of a syntax Analyzer for a Sample Language.
UNIT III SYNTAX DIRECTED TRANSLATION & INTERMEDIATE CODE GENERATION 9
Syntax directed Definitions-Construction of Syntax Tree-Bottom-up Evaluation of SAttribute Definitions- Design of predictive translator - Type Systems-Specification of a simple type Checker-Equivalence of Type Expressions-Type Conversions. Intermediate Languages: Syntax Tree, Three Address Code, Types and Declarations, Translation of Expressions, Type Checking, Back patching.
UNIT IV RUN-TIME ENVIRONMENT AND CODE GENERATION 9
Runtime Environments – Source language issues – Storage organization – Storage Allocation Strategies: Static, Stack and Heap allocation - Parameter Passing-Symbol Tables -Dynamic Storage Allocation - Issues in the Design of a code generator – Basic Blocks and Flow graphs - Design of a simple Code Generator - Optimal Code Generation for Expressions.
UNIT V CODE OPTIMIZATION 8
Principal Sources of Optimization – Peep-hole optimization - DAG- Optimization of Basic Blocks - Global Data Flow Analysis - Efficient Data Flow Algorithm . Recent trends in Compiler Design.
COURSE OUTCOME(S):
Upon successful completion of the course, the students will be able to:
CO1 Understand the techniques in different phases of a compiler.
CO2 Design a lexical analyser for a sample language and learn to use the LEX tool.
CO3 Apply different parsing algorithms to develop a parser and learn to use YACC tool.
CO4 Understand semantics rules (SDT), intermediate code generation and run-time environment.
CO5 Implement code generation.
CO6 Apply the various optimization techniques
TEXT BOOK:
Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman, “Compilers: Principles, Techniques and Tools”, Second Edition, Pearson Education Limited, 2014. .
REFERENCES :
1.Des Watson,A Practical Approach to Compiler Construction- 2017.
2. Allen I. Holub, Compiler Design in C‖, Prentice-Hall Software Series, 2014.
3. Randy Allen, Ken Kennedy, and Optimizing Compilers for Modern Architectures:A Dependence based Approach, Morgan Kaufmann Publishers, 2002.
4. Steven S. Muchnick, Advanced Compiler Design and Implementation‖, MorganKaufmann Publishers - Elsevier Science, India, Indian Reprint 2003.
5. Keith D Cooper and Linda Torczon, Engineering a Compiler‖, Morgan KaufmannPublishers Elsevier Science, 2004.
6. V. Raghavan, Principles of Compiler Design‖, Tata McGraw Hill Education Publishers, 2010.
WEB REFERENCES :
1. https://www.geeksforgeeks.org/introduction-of-compiler-design/
2. https://www.javatpoint.com/compiler-tutorial
3. https://www.tutorialspoint.com/compiler_design/index.html
ONLINECOURSES/RESOURCES :
1. https://onlinecourses.nptel.ac.in/noc23_cs57/preview
2. https://www.udemy.com/topic/compiler-design/