21CS1603

COMPILER DESIGN     

(Lab Integrated)

21CS1603                     COMPILER DESIGN                       L T P C

                                                                                                         3 0 2 4 

OBJECTIVES: 

To impart Knowledge on the following topics:  

 

UNIT I   INTRODUCTION TO COMPILERS            

Phases of a compiler – Lexical Analysis – Role of Lexical Analyzer –Specification of Tokens – Recognition of Tokens – Lex – Finite Automata – Regular Expressions to Automata – Minimizing DFA - Error Detection and Recovery – Lexical Phase Error Management. 

SUGGESTED ACTIVITIES:  

SUGGESTED EVALUATION METHODS:  

UNIT II SYNTAX ANALYSIS         12

Context-Free Grammar (CFG) – Derivation Trees – Ambiguity in Grammars and Languages – Need and Role of the parser - Top Down Parsing - Recursive Descent Parser - Predictive Parser - LL(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 - Parser Generators -YACC 

SUGGESTED ACTIVITIES:  

SUGGESTED EVALUATION METHODS:  

UNIT III                INTERMEDIATE CODE GENERATION                      

Syntax Directed Definitions, Evaluation Orders for Syntax Directed Definitions, Inherited and Synthesized Attributes - Syntax Directed Translation - Construction of Syntax Tree-Type Systems-Specification of a simple type checker. Intermediate Languages: Three address code – Types of Three address code – Quadruple, Triples, Three-address code for Declarations, Arrays, Loops, Back patching. 

SUGGESTED ACTIVITIES:  

SUGGESTED EVALUATION METHODS:  

UNIT IV CODE OPTIMIZATION 8 

Principal Sources of Optimization – Peep-hole optimization – DAG - Optimization of Basic Blocks Global Data Flow Analysis - Efficient Data Flow Algorithm.

SUGGESTED ACTIVITIES: 

SUGGESTED EVALUATION METHODS:  


UNIT V   RUN-TIME ENVIRONMENT AND CODE GENERATION         8

Storage Organization, Stack Allocation Space - Access to Non-local Data on the Stack - Heap Management - Issues in Code Generation - Design of a Simple Code Generator. 

SUGGESTED ACTIVITIES:  

SUGGESTED EVALUATION METHODS:  

LIST OF EXPERIMENTS:

OUTCOMES: At the end of the course, the student will be able to 

1. Design and implement a prototype compiler 

2. Apply the various optimization techniques 

3. Use the different compiler construction tools

4. Acquire knowledge in Syntax directed definition and Run time environment 

5. Develop the various parsing techniques and different levels of translation 

6. Build target code for backend compiler 

TEXT BOOK:

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