Compiler Design

The phases of a compiler, from lexical and syntax analysis through intermediate code generation and optimization, with lab work implementing basic compiler tools.

Course: CSE 401/402 (lecture and lab)

Institution: Dhaka International University

Taught: Fall 2017

Enrollment: 33 students in lecture and 49 in lab

Course Overview

This course teaches the compilation process so that students understand how a program moves from source code to target code and can implement basic compiler tools. The lecture covered the theory of each compiler phase, and the accompanying lab gave students hands-on practice building them.

Learning Objectives

After completing this course, students will be able to:

  • Define and describe compiler design
  • Classify and compare the phases of a compiler
  • Explain the compilation process
  • Implement basic compiler tools

Assessment

Short and broad questions, quizzes, class tests, a midterm and final exam, assignments, and presentations.

Schedule

Each 80-minute lecture combined whiteboard and slide-based instruction with questions, group exercises, and live demonstrations.

Lectures Topic
1–4 Foundations of Compiler Design

Compilers and interpreters, the analysis–synthesis model, and the phases of a compiler.

5–6, 10 Terminology of Lexical Analysis

Alphabets, strings, and languages; prefixes, suffixes, and substrings; Kleene and positive closure.

7–9 Parsing and Derivation

Derivations, ambiguity and how to remove it, and common errors across compiler phases.

11–16, 18 Regular Expressions and Finite Automata

Transition diagrams, NFAs and DFAs, converting between regular expressions, NFAs, and DFAs, and from regular expressions to context-free grammars.

17, 19–20 Code Generation and Optimization

Register allocation by graph coloring, run-time structures, backpatching, partial redundancy elimination, and constant propagation.

21–23 Syntax-Directed Translation

SLR parsing, translation of Boolean expressions, and control flow graphs.

24 Course Review