Compiler Design and Construction - Syllabus

Embark on a profound academic exploration as you delve into the Compiler Design and Construction course () within the distinguished Tribhuvan university's CSIT department. Aligned with the 2065 Syllabus, this course (CSC-352) seamlessly merges theoretical frameworks with practical sessions, ensuring a comprehensive understanding of the subject. Rigorous assessment based on a 60+20+20 marks system, coupled with a challenging passing threshold of , propels students to strive for excellence, fostering a deeper grasp of the course content.

This 3 credit-hour journey unfolds as a holistic learning experience, bridging theory and application. Beyond theoretical comprehension, students actively engage in practical sessions, acquiring valuable skills for real-world scenarios. Immerse yourself in this well-structured course, where each element, from the course description to interactive sessions, is meticulously crafted to shape a well-rounded and insightful academic experience.

Course Synopsis: Analysis of source program. The phases of compiler.
Goal:   This course introduces fundamental concept of compiler and its different phases.


Unit 1

1.1 Introduction to compiling: Compilers, analysis of source program, compilers phases, compiler construction tools (Chapter 1)    4hrs

1.2 A simple one pass Compiler: syntax definition, syntax directed translation, parsing, translation for simple expression, symbol table, abstract stack machine. (Chapter 2)    5 hrs

Unit 2

2.1 Lexical analysis: Role of lexical analyzer, input buffering, specification and recognition of tokens, finite automata, Conversion regular expression to NFA – Thomson’s Construction, NFA to DFA –subset construction, regular expression to DFA, State minimization in DFA, Flex/lex introduction. (Chapter – 3)         8hrs

2.2 Syntax Analysis: Role of Parser, Context Free Grammar, writing a grammar, Top-down Parsing – recursive decent parsing, non-recursive predictive parsing, error recovery mechanism, LL grammar, Bottom up parsing – handles, shift reduced parsing, LR Parsers – SLR, LALR, LR, LR/LALR Grammars, Parser Generator. (Chapter 4.1 -4.5,4.7 & 4.9)     10hrs

Unit 3

3.1 Syntax directed translation: Syntax directed definitions, syntax tree construction, synthesized and inherited attributes, dependency graph, S-attributed definitions, L- attributed definition, Translations schemes, Top-down and bottom-up evaluation.(Chapter 5.1 – 5.6) 5hrs

3.2 Type Checking: Type system, Specification simple type checker, equivalence of type expression, Type conversion. Type checking Yacc/Bison (Chapter 6.1 -6.4)     3hrs

Unit 4

4.1: Intermediate languages, Three address code, Declarations, assignment statement, addressing array elements, Boolean expressions, case statements, procedure calls, backpatching. (Chapter 8.1 – 8.7) 4hrs

4.2: Code Generation and Optimization: Code generator design issues, target machine, runtime storage management, basic blocks and flow graphs, next use information, simple code generator, Peephole optimization. (Chapter 9.1 – 9.6 & 9.9 ) 6hrs