Sei sulla pagina 1di 2


Course Objectives:





An ability to design and implement a significant portion of a compiler for a language

Working knowledge of the major phases of compilation

Apply the ideas, the techniques, and the knowledge acquired for the purpose of other software design

Unit I


Overview of compilation : The structure of a compiler, The applications of compiler technology, Lexical Analysis, Syntax Analysis, Semantic Analysis, Intermediate Code Generation, Symbol Table management, Compiler-Construction Tools, Implementation of High Level Programing Language, Optimizations for Computer Architecture, Design of new Computer Architecture, Program Translation, Software Productivity Tools

Lexical Analysis : Role of lexical analyzer, Lexical Analysis versus Parsing, Tokens, Patterns, and Lexemes, Attributes for tokens, Lexical errors, Input buffering, Buffer pairs, Sentinels, specifications of tokens, Strings and Languages, Operations on Languages, Regular Expressions, Regular Definitions, Recognition of tokens, Transition diagrams, Lex - Lexical-Analyzer Generator, Use of Lex, Structure of Lex Programs, Conflict resolution in Lex, The Lookahead operator, Hand-written lexical analyzers, Examples of LEX programs.

Unit II


Syntax Analysis : Role of a parser, Representative Grammars, Syntax error handling, Context-Free Grammars, Definition of Context-Free Grammar, Notational conventions, Derivations, Parse trees and Ambiguity, Verifying the Language generated by a grammar, Context-Free Grammar versus Regular Expressions, Use of context-free grammars (CFG) in the specification of the syntax of programming languages,, Writing a grammar, Lexical versus Syntactic analysis, Eliminating ambiguity, Elimination of Left Recursion, Techniques for writing grammars for programming languages (removal left recursion, etc.), Left factoring, Non- context- free constructs in programming languages, Top-down parsing, Recursive descent parsing., FIRST & FOLLOW sets, LL(1) conditions, Predictive parsing., Handle pruning, Shift-reduce parsing, operator precedence grammars, LR-parsing, LR(0) automaton, Valid items, LR-parsing algorithm, Viable prefixes, SLR(1), LR(1), and LALR(1) parsing, Error recovery, Examples of programming language grammars., YACC, error recovery with YACC and examples of YACC specifications

Unit III


Syntax Directed Translation : Syntax-directed definitions (attribute grammars), Inherited and Synthesized attributes, Evaluation orders for SDD's, Dependency graphs, Ordering the Evaluation of Attributes, S-Attributed Definitions, L-Attributed Definitions, Applications of syntax directed translation, Construction of Syntax Trees, The Structure of a Type, Implementing L-Attributed SDD's, L-Attributed SDD's and LL Parsing

Unit IV


Semantic analysis : Symbol tables and their data structures, Representation of “scope”, Semantic analysis of expressions, Assignment, and control-flow statements, Declarations of variables and functions, function calls, etc. using S- and L-attributed SDDs (treatment of arrays and structures included), Semantic error recovery

Unit V


Print Date : 2/8/2014 12:01:52 PM

Unit V

Intermediate Code Generation : Three address Code, Quadruples, Triples, Trees and their usees, Static Single Assignment Form, Flow graphs, SSA forms and their uses, Translation of expressions (including array references with subscripts) and assignment statements, Operations within Expressions, Addressing Array Elements, Translation of Array References, Translation of control-flow statements – if-then-else, while-do, and switch, Short-circuit code and control-flow translation of Boolean expressions, Control-Flow Analysis, Backpatching, Different intermediate representations, Examples to illustrate intermediate code generation for all constructs

Unit VI


Run Time Environments : storage organization, Stack allocation of space., Activation Trees, Activation Records, Calling Sequences, Variable-Length Data on the Stack, Access to non-local data on the stack in the case of procedures with and without nesting of procedures, Data Access Without Nested Procedures, Issues with Nested Procedures, A Language with Nested Procedure Declarations

Introduction to machine code generation and optimization : Simple machine code generation, examples of machine-independent code optimizations, Register and Address Descriptors, The Code-Generation Algorithm, A running example:Quicksort

Text Books:



Compilers Principles, Techniques and Tools by Alfred V.Aho, Monica S.Lam ,Ravi

Sethi, Jeffrey D.Ullman, Pearson, 2nd Edition, (2007)


1. Lex & Yacc by Levine,Mason and Brown, O’REILLY, 2nd Edition, (2012)

2. Engineering a Compiler by K.D. Cooper, and Linda Torczon, Morgan Kaufmann

Publishers, 1st Edition, (2004)


Print Date : 2/8/2014 12:01:52 PM