CS405
PRINCIPLES OF COMPILER DESIGN
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
Outcomes
- Ability to apply the knowledge of lex tool & yacc tool to develop a scanner & parser
- Ability to design and develop software system for backend of the compiler
- Ability to comprehend and adapt to new tools and technologies in compiler design
Unit – I
Introduction to Compiling- 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- 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- Intermediate languages – Declarations – Assignment Statements – Boolean Expressions – Case Statements – Back patching – Procedure calls.
Unit – IV
Code Optimization and Run Time Environments- 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- 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.
TEXT BOOKS
- Alfred V. Aho, Jeffrey D Ullman, “Compilers: Principles, Techniques and Tools”, Pearson Education Asia, 2008
- Jean Paul Tremblay, Paul G Serenson, "The Theory and Practice of Compiler Writing", BS Publications, 2005
- Dhamdhere, D. M., "Compiler Construction Principles and Practice", 2nd edition, Macmillan India Ltd., New Delhi, 2008
REFERENCE
- Allen I. Holub, “Compiler Design in C”, Prentice Hall of India, 2003
- C. N. Fischer and R. J. LeBlanc, “Crafting a compiler with C”, Benjamin Cummings, 2003
- Henk Alblas and Albert Nymeyer, “Practice and Principles of Compiler Building with C”, PHI, 2001
- Kenneth C. Louden, “Compiler Construction: Principles and Practice”, Thompson Learning, 2003