COMP 520 - Compilers

Spring 2022
Tue, Thu 2:00 - 3:15PM FB009
Jan 11 - Apr 28
in-person classroom instruction
Instructor: Jan Prins ( FB 334 office hours Wed 2 - 4 PM
TA: Tao Tao ( FB 357 office hours Mon 2 - 4 PM


This upper-level undergraduate class (also available for graduate credit) extends and integrates material from prerequisite courses to build a compiler for a non-trivial subset of the Java programming language. Java is also the implementation language for the compiler. Upon completion of this course, you should:

Course Syllabus

Administrative details, such as prerequisites, exam dates, honor code, and the sequence of topics covered in the course can be found in the course syllabus


Programming Language Processors in Java: Compilers and Interpreters, by David Watt and Deryck Brown, Prentice Hall, 2000 (ISBN 0-130-25786-9).

[Course text] Watt & Brown, Programming Language Processors in Java

@ Announcements

@ Reading Assignments

@ Written Assignments

  1. wa1 (due Thu 1/13) wa1 sample solutions
  2. wa2 (due Fri 1/28) wa2 sample solutions
  3. wa3 (due Tue 2/22 at start of class) wa3 sample solutions

@ miniJava Project Programming Assignments

  1. pa1 - Syntactic Analysis
    • pa1 is graded.
    • Download pa1_tests (zipped) to correct any scannning or parsing errors in syntactic analysis.
  2. pa2 - Abstract Syntax Tree Construction
  3. pa3 - Contextual Analysis
    • pa3 due date is extended to midnight Wed Apr 6.
    • pa3 is graded. Your pa3 score is in your pa3 submission directory.
    • pa3 tests are available in (zipped)
  4. pa4 - Code Generation
  5. pa5 - final submisssion
    • pa5 adds no additional functionality, unless you elect to implement one of the optional extensions in the pa5 handout.
    • pa5 is due Wed Apr 27 (last day of classes)
    • Place the final version of your compiler project in this directory. If you add optional extension(s), please provide a short description of the extension(s).
    • pa5 tests available here. [NEW]

@ Examples

@ Lecture Materials

  1. 01-Intro
  2. 02-PLspec
  3. 03-CFG-Parsing
  4. 04-EBNF-RDparsing
  5. 05-Lexical_Analysis
  6. 06-Compiler_Structure
  7. 07-Precedence
  8. 08-AbstractSyntaxTrees
  9. 09-ASTwrapup_BUparsing
  10. 10-Identification
  11. 11-Types
  12. 12-Contextual Analaysis
  13. 12a-Visitor Interface
  14. 13-Runtime Organization
  15. 14-CodeGeneration (parts 1 and 2)
  16. 15-miniJavaCodegenExample
  17. 16-OORuntime
  18. 17-VirtualMachines
  19. 18-RiscCodeGeneration
  20. 19-Bootstrapping [NEW]

This page is maintained by Send mail if you find problems.