Summer 2019 - CMPT 379 D100

Principles of Compiler Design (3)

Class Number: 4805

Delivery Method: In Person


  • Course Times + Location:

    Tu 10:30 AM – 11:20 AM
    BLU 9660, Burnaby

    Th 9:30 AM – 11:20 AM
    SSCK 9500, Burnaby

  • Exam Times + Location:

    Aug 9, 2019
    12:00 PM – 3:00 PM
    EDB 7618, Burnaby

  • Prerequisites:

    MACM 201, (CMPT 150, CMPT 295 or ENSC 215) and CMPT 225.



This course covers the key components of a compiler for a high level programming language. Topics include lexical analysis, parsing, type checking, code generation and optimization. Students will work in teams to design and implement an actual compiler making use of tools such as lex and yacc.


As Steve Yegge said, "If you don't know how compilers work, then you don't know how computers work." ( This is a course for those who are interested in the design and implementation of programming languages. Compilers let us to use a high-level programming language by translating programs into low-level machine code. Understanding how compilers work is essential if you want to be a good programmer. In this course, you will build a working compiler using lex, yacc and LLVM (it's ok if you don't know what those terms mean).


  • Overview of a compiler
  • Lexical Analysis: regular expressions
  • Simple Parsing: context-free grammars, top-down and bottom-up parsing
  • LL(1) parsing: efficient top-down parsing
  • Shift-reduce parsers: introduction to bottom-up parsing
  • SLR/LR parsing: fast and efficient bottom-up parsing
  • Type checking: checking semantics of programs
  • Semantics and code generation: from a high-level language to assembly language
  • Optimization: an introduction to various types of code optimization



The grade distribution will be handed out at the start of classes.

Students must attain an overall passing grade on the weighted average of exams in the course in order to obtain a clear pass (C- or better).



Reference Books

  • Compilers: Principles, Techniques and Tools (2nd Edition), A. V. Aho, M. S. Lam, R. Sethi, and J. D. Ullman, Addison-Wesley, 2006, 9780321486813, The purple dragon book

Registrar Notes:

SFU’s Academic Integrity web site is filled with information on what is meant by academic dishonesty, where you can find resources to help with your studies and the consequences of cheating.  Check out the site for more information and videos that help explain the issues in plain English.

Each student is responsible for his or her conduct as it affects the University community.  Academic dishonesty, in whatever form, is ultimately destructive of the values of the University. Furthermore, it is unfair and discouraging to the majority of students who pursue their studies honestly. Scholarly integrity is required of all members of the University.