Syllabus
Unit 1
Introduction To Compilers: Definition of compiler, interpreter and its differences, the phases of a compiler, role of lexical analyzer, regular expressions, finite automata, from regular expressions to finite automata, pass and phases of translation, bootstrapping, LEX-lexical analyzer generator.
Unit 2
Parsing: Parsing, the role of the parser, context free grammar, derivations, parse trees, ambiguity, elimination of left recursion, left factoring, eliminating ambiguity from dangling-else grammar, classes of ptop-downtop down parsing – backtracking, recursive descent parsing, predictive parsers, LL (1) grammars.
Bottom-Up Parsing: Definition of bottom-up parsing, handles, handle pruning, stack implementation of shift-reduce parsing, conflicts during shift-reduce parsing, LR grammars, LR parsers-simple LR, canonical LR(CLR) and Look Ahead LR (LALR) parsers, error recovery in parsing, parsing ambiguous grammars, YACC-automatic parser generator.
Unit 3
Syntax Directed Translation: Syntax directed definition, construction of syntax trees, S-attributed and L-attributed definitions, translation schemes.
Intermediate Code Generation: intermediate forms of source programs– abstract syntax tree, polish notation and three address code, types of three address statements and their implementation syntax-directed translation into three-address code, translation of simple statements, Boolean expressions and flow-of-control statements.
Unit 4
Type Checking: Definition of type checking, type expressions, type systems, static and dynamic checking of types, specification of a simple type of checker, equivalence of type expressions, type conversions, overloading of functions and operators.
Run Time Environments: Source language issues, Storage organization, storage-allocation strategies, access to non-local names, parameter passing, symbol tables and language facilities for dynamic storage allocation.
Unit 5
Code Optimization: Organization of code optimizer, basic blocks and flow graphs, optimization of basic blocks, the principal sources of optimization, the directed acyclic graph (DAG) representation of basic block, and global data flow analysis.
Code Generation: Machine dependent code generation, object code forms, the target machine, a simple code generator, register allocation and assignment, peephole optimization.
Objectives and Outcomes
Course Description
A compiler is system software that is required to convert computer programmes into a format that can be executed on the intended machine. Creating a compiler necessitates knowledge of several areas of computer science, including logic, formalism, mathematics, data structures, algorithms, and programming. This course is intended to serve as an introduction to the various stages involved in the design of standard compilers, beginning with the front-end stages of compilation and progressing to the back end and some recent advancements in the field.
Course Objectives
The goal of this course is to educate students on the phases of a compiler and the techniques for designing a compiler. This course introduces students to the fundamental concepts of compilation phases such as lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, and code generation.
Course Outcomes
|
COs
|
Description
|
|
CO1
|
Describe stages of compilation, and lexical Analysis
|
|
CO2
|
Compare different types of parsers (Bottom-up and Top-down) and construct a parser for a given grammar.
|
|
CO3
|
Analyze syntax directed translation and representations of intermediate code
|
|
CO4
|
Describe type checking and run time environment
|
|
CO5
|
Illustrate code optimization and code generation techniques in the compilation.
|
CO-PO Mapping
|
PO/PSO
|
PO1
|
PO2
|
PO3
|
PO4
|
PO5
|
PO6
|
PO7
|
PO8
|
|
CO
|
|
CO1
|
2
|
2
|
–
|
–
|
–
|
–
|
–
|
2
|
|
CO2
|
2
|
2
|
–
|
–
|
–
|
–
|
–
|
2
|
|
CO3
|
3
|
3
|
2
|
–
|
–
|
–
|
–
|
2
|
|
CO4
|
3
|
3
|
2
|
–
|
–
|
–
|
–
|
2
|
|
CO5
|
3
|
3
|
–
|
–
|
–
|
–
|
–
|
2
|