Course Objectives:

  1. Apply the knowledge of lex tool & yacc tool to develop a scanner & parser.
  2. Design and conduct experiments for Intermediate Code Generation in compiler.
  3. Develop program to solve complex problems in compiler
  4. Learn the new code optimization techniques to improve the performance of a program in terms of speed and space.

Unit I

Introduction: Compilers and translators need of translators, structure of compiler: its different phases,Compiler construction tools.

Lexical Analysis: Role of lexical analyzer; Design of lexical analyzer; Regular expressions ;Specificationand recognition of tokens; Input buffering; Finite automata; Conversion from regular expression to finite automata, and vice versa; Minimizing the number of states of DFA, Implementation of lexical analyzer.

Click on any topic to read about the topic.

Unit II

Syntactic Techniques & Parsing: Context free Grammars; Derivations & parse trees; Capabilities ofCFGs; Role of parsers, Shift- Reduce Parsing ; Operator precedence parsing; top down parsing; predictive parsing, LR parsers; LR(0) items SLR, LALR and Canonical LR parser.

Click on any topic to read about the topic.

Unit III

Syntax Directed Translation , Symbol Table & Error Handling : Syntax directed definition,construction of syntax trees, syntax directed translation scheme, implementation of syntax directed translation, Intermediate Code ;Parse trees & Syntax trees; Three address code, quadruples and triples; Translation of Boolean Expressions. Symbol tables, its contents and data structure for symbol tables; trees, arrays, linked lists, hash tables ; Operations on symbol table; Errors( lexical phase error, syntactic phase error, semantic error).

Click on any topic to read about the topic.

Unit IV

Code Optimization & Code Generation: Sources of code optimization; Loop optimization (Denominators, Reducible flow graphs, depth first search, loop invariant computation, Induction variable elimination ) ; Directed acyclic representation of basic blocks Code generation, forms of objects code, machine dependent code, register allocation for temporary and user defined variables; Problems in code generation; Peephole optimization.

Click on any topic to read about the topic.


  1. Compilers Principle, Techniques & Tools – Alfread V. AHO, Ravi Sethi& J.D. Ullman; – 1998Addison Wesley.
  2. Theory and practice of compiler writing, Tremblay & Sorenson, 1985, Mc. Graw Hill.
  3. System Software by Dhamdhare, 1986, MGH.
  4. Principles of Compiler Design, Alfred V Aho , Jeffery D. Ullman , Narosa Publication

Course Outcomes:  After successful completion of the course:-

  1. Students will get the concepts of Compilers and the actual roles of the lexical analyzer
  2. Students will get the concepts of different Parsing techniques and Construction of syntax trees
  3. Students will get the concepts of Type checking and Run time environments
  4. Students will get the concepts of Intermediate code generation, Code optimization and Code generations.
error: You can only copy the programs code and output from this website. You are not allowed to copy anything else.