Course Code: PCC-CSE-302G
Category: Professional Core Course
Course Title: Compiler Design
Scheme and Credits
| L | T | P | Credits | |
|---|---|---|---|---|
| Semester 6 | 3 | 0 | 0 | 3 |
| Marks | |
|---|---|
| Class work | 25 Marks |
| Exam | 75 Marks |
| Total | 100 Marks |
Duration of Exam: 03 Hours
Objectives of the Course:
- To understand and list the different stages in the process of compilation.
- Identify different methods of lexical analysis.
- Design top-down and bottom-up parsers.
- Identify synthesized and inherited attributes.
- Develop syntax directed translation schemes.
Note: Examiner will set nine questions in total. Question one will be compulsory. Question one will have 6 parts of 2.5 marks each from all units and remaining eight questions of 15 marks each to be set by taking two questions from each unit. The students have to attempt five questions in total, first being compulsory and selecting one from each unit.
UNIT 1
Introduction to Compilers: Language Processors, The Structure of compiler: its different phases, Compiler Construction Tools, Applications of Compiler Technology.
Lexical Analysis: Role of lexical analyzer, Input Buffering, Specification and recognition of tokens, design of lexical analyzer, regular expressions, A language specifying lexical analyzer, Finite automata, conversion from regular expression to finite automata, and vice versa, minimizing number of states of DFA, Implementation of lexical analyzer.
UNIT 2
Syntax Analysis: Role of parsers, context free grammars.
Parsing Technique: Shift-reduce parsing, Operator precedence parsing, Top down parsing, Predictive parsing.
UNIT 3
LR parsers, SLR, LALR and Canonical LR parser.
Syntax Directed Translations: Syntax directed definitions, construction of syntax trees, syntax directed translation scheme, implementation of syntax directed translation, Intermediate-Code Generation: three address code, quadruples and triples.
UNIT 4
Symbol Table & Error Detection and Recovery: Symbol tables: its contents and data structure for symbol tables; trees, arrays, linked lists, hash tables. Errors, lexical phase error, syntactic phase error, Semantic error.
Code Optimization & Code Generation: Code generation, forms of objects code, machine dependent code, optimization, register allocation for temporary and user defined variables.
Suggested Text Books:
- Compilers Principle, Techniques & Tools - Alfread V. AHO, Ravi Sethi & J.D. Ullman; 1998 Addison Wesley.
Suggested Reference Books:
- Theory and practice of compiler writing, Tremblay & Sorenson, 1985, Mc. Graw Hill.
- System software by Dhamdere, 1986, MGH.
- Principles of compiler Design, Narosa Publication
- Elements compiler Design, Dr. M. Joseph, University Science Press
Course Outcomes:
- To develop the lexical analyser for a given grammar specification.
- For a given parser specification design top-down and bottom-up parsers.
- To Develop syntax directed translation schemes.