55AA-009

Compiler Principles

Level
Undergraduate
Status
Under development

Note: this course is still being designed and calibrated; the page content is for reference and does not represent the final teaching version.

Syllabus

Course Overview

Compiler Principles is organized around a working compiler, from lexing, parsing, semantic analysis, IR, optimization, to code generation. The compiler is treated as a common foundation for programming languages, static analysis, runtimes, and security checks.

This is a foundation for program analysis, software security, and formal tooling.

Prerequisites

  • Discrete mathematics, data structures, and systems programming.
  • Familiarity with at least one typed or scripting language.
  • Ability to read recursive algorithms and basic formal-language material.

Learning Outcomes

  • Implement lexing, parsing, and semantic checks.
  • Design an intermediate representation and basic optimizations.
  • Generate executable or interpretable target code.
  • Understand types, scope, control flow, and data flow.
  • Apply compiler techniques to static checks and security tools.

Course Format

  • Two meetings per week: one for core concepts and one for labs, paper discussion, or project review.
  • The course proceeds over 16 weeks, each with a checkable assignment, lab, or project milestone.
  • Reproducibility is required: code, configuration, data, lab logs, and reports must be reviewable by staff or peers.

Weekly Plan

Week 2

Language design and compiler structure: lab and review

Define the course language and test framework. Complete the paired lab, record issues, and explain design tradeoffs in class review.

Week 4

Lexing and regular languages: lab and review

Implement a lexer and source-location errors. Complete the paired lab, record issues, and explain design tradeoffs in class review.

Week 6

Parsing and ASTs: lab and review

Implement a parser and emit ASTs. Complete the paired lab, record issues, and explain design tradeoffs in class review.

Week 8

Scope, types, and semantic analysis: lab and review

Complete symbol tables and type checking. Complete the paired lab, record issues, and explain design tradeoffs in class review.

Week 10

IR, control flow, and data flow: lab and review

Generate IR and control-flow graphs. Complete the paired lab, record issues, and explain design tradeoffs in class review.

Week 12

Optimization and analysis: lab and review

Implement constant propagation or dead-code elimination. Complete the paired lab, record issues, and explain design tradeoffs in class review.

Week 14

Code generation and runtime: lab and review

Generate target code or a bytecode interpreter. Complete the paired lab, record issues, and explain design tradeoffs in class review.

Week 16

Compiler extensions and security checks: lab and review

Add a language feature or static security check. Complete the paired lab, record issues, and explain design tradeoffs in class review.

Assessment

Individual assignments

Concept questions, reading responses, design tasks, and small programming or lab exercises.

25%
Labs and project

Compiler milestones, test suites, and a final extension.

40%
Participation and review

Participation in discussions, demos, code or paper reviews, and peer feedback.

10%
Final report and defense

Submit reproducible artifacts, a technical report, and a demo explaining methods, results, limitations, and future work.

25%

Course Project

Students build a small compiler in stages and add a final extension such as a type feature, optimization, interpreter, diagnostics, or security lint.

Policies

  • AI tools are allowed, but generated code, lab notes, and design suggestions must be reviewed by the student and disclosed in the report.
  • Students may not submit code, proofs, configuration, or experimental results they cannot explain; each member must defend their own design, tests, and tradeoffs.
  • Late work affects iteration grades, but the course values reproducible, auditable, and maintainable results over last-minute accumulation.

Reference Courses

China 985 Universities