Sidho-Kanho-Birsha University · Undergraduate programmes under NEP 2020 SearchExamsCoverage
SKBU SyllabusUndergraduate · CCFUP
BCOSMAJ15CComputer Science

Compiler Design

Semester
8
Credits
4
Course type
MAJ-15
Theory / Practical
Combined
L–P–Tu ?
3-1-0
LecturePracticalTutorial
Official source ↗

Course objective

• To comprehend design issues of a lexical analyzer and use of Lex tool. • To comprehend design issues of a parser and use of YACC tool. • To comprehend issues related to memory allocation. • To Comprehend design code generation phase. • To comprehend the working of linkers and loaders and other development utilities.

Learning outcome

• Understand phases in the design of compiler. • Design top-down and bottom-up parsers. • Identify synthesized and inherited attributes. • Develop syntax directed translation schemes. • Develop algorithms to generate code for a target machine. • Process of designing and implementing System programs and operating system components. • Design structure of Assembler and macro processor for a hypothetical simulated.

Full syllabus

Theory

System Software: Introduction, Definition, Role and Functions, characteristics, types. (2 Lectures)

Assembler: Introduction, functions, features, design of one pass and two pass assemblers. (2 Lectures)

Microprocessors: Introduction, functions, features and design. (2 Lectures)

Loader and Linkers: Basic Concepts of Linkers and Loader Functions, Boot Loaders, Linking Loaders, Linkage Editors, Dynamic Linking.

(2 Lectures)

Overview of Compiler: Overview of a compiler; structure, phases and passes of compiler; problems of compiler design; application of compiler design technology; interdependencies between compiler and computer architecture. (3 Lectures)

Formal Languages: Elements of formal language theory; Regular Languages; Regular grammars, regular expressions, finite state automata; conversions; state minimization. (4 Lectures) Lexical Analysis: Role of Lexical Analyzer, Interface with input, parser and symbol table, Input Buffering, Specification of Tokens, lexeme and patterns; difficulties in lexical analysis; error reporting; Finite state machines and regular expressions and their applications to lexical analysis, regular definition, transition diagrams, Lex., Review of regular languages, design and implementation of a lexical analyzer. (6 Lectures)

Syntax Analysis / Parsing: Role of the parser, Formal and context free grammars (CFGs) and their application to syntax analysis, ambiguity, associatively, precedence, Derivation and parse trees, Top Down parsing, LL (1) grammars, recursive descent parsing, transformation on the grammars, predictive parsing, bottom up parsing, Shift Reduce Parsing, LR(0) grammars, operator precedence grammars, LR parsing algorithms and LR parsers, Yacc. (6 Lectures)

Type Checking: Type system, type expressions, structural and name equivalence of types, type conversion. (3 Lectures)

Syntax directed translation and Definitions: Syntax directed definitions, Construction of syntax trees, Top down and bottom-up approaches, dependency graph, data types, mixed mode expression; subscripted variables, evaluation order and sequencing statement, Inherited and synthesized attributes, bottom up and top-down evaluation of attributes, L- and S-attributed definitions. (5 Lectures)

Intermediate Code Generation: Intermediate languages, Intermediate Graphical representations, three address code, Implementation of three address statements (Quadruples, Triples, Indirect triples), translation of declarations, assignments, control flow, Boolean expressions and procedure calls, implementational issues. (4 Lectures)

Code Optimization and generation: Introduction and Issues, Basic blocks and flow graphs, Transformation of basic blocks, DAG representation of basic blocks, code generation from dags, Loops in flow graph, Principal sources of optimization, Peephole optimization, machine dependent and machine independent optimization techniques, Issues in the design of code generator, Register allocation and assignment, code generation, specifications of machine. (4 Lectures)

Subroutines and functions: parameters called by address, by name and by value, subroutines with side effects. (2 Lectures)

Compiler Design Lab

  1. Develop programs for lexical analyzer to recognize all the valid tokens.
  2. Develop lex programs to print number of lines, number of characters, number of white spaces etc.

References

1. Compilers – Principles, Techniques & Tools: Aho, Sethi & Ullman, Addison Wesley.

2. Compiler Design in C: Holub, PHI.

3. Compiler Design: Dhamdhere.

4. Principles of Compiler Design: Alfred V. Aho & Jeffrey D. Ullman, Narosa

5. John R Levine, Tony Mason, Doug Brown, Lex and Yacc, Orielly

6. Randy Allen, Ken Kennedy, Optimizing Compilers for Modern Architectures, Morgan Kauffmann, 2001

7. O.G. Kakde, Compiler design, Laxmi Publications

Where this paper is used