Subject Code: CS4L001 Subject Name: Compiler Design L-T-P: 3-0-0 Credits: 3
Pre-requisite(s):  Introduction to Programing and Data Structures, Formal Languages & Automat Theory
 Introduction: Overview and phases of compilation; Lexical Analysis: Non-deterministic and deterministic finite automata (NFA & DFA), regular grammar, regular expressions and regular languages, design of a lexical analyser as a DFA, lexical analyser generator; Syntax Analysis: Role of a parser, context free grammars and context free languages, parse trees and derivations, ambiguous grammar; Top Down Parsing: Recursive descent parsing, LL(1) grammars, non-recursive predictive parsing, error reporting and recovery; Bottom Up Parsing: Handle pruning and shift reduces parsing, SLR parsers and construction of SLR parsing tables, LR(1) parsers and construction of LR(1) parsing tables, LALR parsers and construction of efficient LALR parsing tables, parsing using ambiguous grammars, error reporting and recovery, parser generator; Syntax Directed Translation: Syntax directed definitions (SDD), inherited and synthesized attributes, dependency graphs, evaluation orders for SDD, semantic rules, application of syntax directed translation; Symbol Table: Structure and features of symbol tables, symbol attributes and scopes; Intermediate Code Generation: DAG for expressions, three address codes - quadruples and triples, types and declarations, translation of expressions, array references, type checking and conversions, translation of Boolean expressions and control flow statements, back patching, intermediate code generation for procedures; Run Time Environment: storage organizations, static and dynamic storage allocations, stack allocation, handlings of activation records for calling sequences; Code Generations: Factors involved, registers allocation, simple code generation using stack allocation, basic blocks and flow graphs, simple code generation using flow graphs; Elements of Code Optimization: Objective, peephole optimization, elimination of local common sub-expressions, redundant and un-reachable codes, flow of control optimization.               
Text Books:
  • K. D. Cooper and L. Torczon, “Engineering a Compiler,” Morgan Kaufman.
  • Alfred V. Aho, Monica S. Lam, Ravi Sethi and Jeffrey D. Ullman, “Compilers: Principles, Techniques and Tools,” Pearson Education.
Reference Book:
  • Compiler Design in C by Holub – PHI.
  • Modern Compiler Design by Dick Grune et al – Wiley India.