Compiler Design
Course Code: CSE 417
Credit Hour: 3
Course Group: Core Courses
Introduction: Introduction to Compiler – Analysis-Synthesis model of Compilation – Phases of a Compiler. Lexical Analysis: Role of a lexical analyzer; Token, lexeme and patterns – Lexical errors – Input buffering – sentinels. Specification of Tokens; Regular Expressions – Recognition of Tokens – Transition diagrams. Finite Automata – NFA – DFA – Simulating a DFA/NFA – Conversion of an NFA into a DFA – NFA from Regular Expressions – Regular Expression to a DFA. Syntax Analysis: Role of the Parser – Context-Free Grammars – Parse Trees & Derivations – Ambiguity – Regular expressions vs. context-free grammars – Elimination of left recursion – Top-down parsing – predictive parsing – bottom-up parsing – LR parsers. Syntax-Directed Translation: Inherited and Synthesized attributes – Form of a Syntax-Directed Definition – Dependency Graph – Construction of syntax trees – Directed Acyclic Graph – Bottom up and Top-down evaluation of attributes – L- and S-attributed definitions. Type Checking: Static checking – Type systems – Specification of a simple type checker – Type checking of Expressions – Type checking of Statements – Type checking of Functions. Intermediate Code Generation: Intermediate language – Types of Three-Address Statements – Implementations of Three-Address Statements – Assignment statements – Boolean expressions. Code Generation: Issues – Basic blocks and Flow graphs. Code Optimization: Principal sources of optimization – Optimization of basic blocks.
Text Book:
- Jeffrey D.Ullman: Compilers: Principles, Techniques and Tools
Reference Books:
- Holub: Compiler design
- Trembly and Sorensen: Theory and practices of Compiler writing