CSC 3120 Compiler Construction (09-10)


[Week #1] [Week #2] [Week #3] [Week #4] [Week #5] [Week #6] [Week #7] [Week #8] [Week #9] [Week #10] [Week #11] [Week #12] [Week #13] [Week #14] [Week #15] [Final Examination]
[ Quiz #1] [Quiz #2] [Quiz #3]
Project

Week #1 (Jan. 12, 13)

  • TOPICS IN THE FRONT-END OF A COMPILER
  • A Compiler
  • The Structure of a Compiler
  • Lexical Analysis
  • Syntax Analysis
  • Semantic Analysis
  • Intermediate Code Generation
  • Optimization
  • Code Generation
  • Introduction to the Compiler Project
  • Overview

    References:
    [ALS+07] 1.1-1.2.8
    Further Reading:
    [ALS+07] Chapter 1

    Week #1 Slides:
    Pre-lecture version - Read - Updated on Jan. 14
    Presentation version - Read


    Tutorial #1 (Jan. 18/19)

  • Phase 1 - Lexer (Scanner)
  • Using JavaCC
  • Structure of a JavaCC File
  • JavaCC Regular Expressions
  • Example of a JavaCC File
  • Matching Conflicts
  • Lexical Actions
  • Options

    References:
    JavaCC Home
    JavaCC Tutorial
    [Ens00] Enseling, O., "Build your own languages with JavaCC", JavaWorld, 2000. Read
    [Kod04] Kodaganallur, V., "Incorporating Language Processing into Java Applications: A JavaCC Tutorial", IEEE SOFTWARE, July/August, 2004, pp. 70-77. Read



    Week #2 (Jan. 19, 20)

  • Topics in the Front-End
  • Context-Free Grammars
  • Parsers
  • Top-Down Parsing
  • Elimination of Left-Recursion
  • Predictive Parsers
  • Left-Factoring
  • The LL(k) Criterion
  • First and Follow Sets
  • Selection Sets
  • Table-Driven Predictive Parsers
  • Syntax Error Handling
  • Syntax Recovery Strategies

    References:
    [ALS+07] 2.1-2.2; 4.1-4.1.2, 4.2-4.4.2

    Week #2 Slides:
    Pre-lecture version - Read
    Presentation version - Read


    Tutorial #2 (Jan. 25/26)

  • Phase 1 - Project Specification
  • Bantam Java Language
  • Bantam vs. Java
  • Example BJ Program
  • Bantam Java Tokens
  • Phase 1 Resources
  • Project Skeleton
  • Development Environments
  • CLI on Windows
  • Eclipse Galileo with Javacc Plugin
  • Configuring the Reference Compiler
  • How to Handle Lexical Errors

    References:
    Bantam Java Compiler Project Lab Manual (Base Version 1.3) - Read

    Slides: Read
    An example using the errorHandler class: Read



    Week #3 (Jan. 26, 27)

  • Table-Driven Predictive Parsers
  • Syntax Error Handling
  • Syntax Recovery Strategies
  • Error Recovery in Predictive Parsing
  • Bottom-Up Parsing
  • Handles
  • Shift-Reduce Parser in Action
  • LR(k) Parsers

    References:
    [ALS+07] 4.4.3-4.4.4; 4.1.3-4.1.4, 4.4.5; 4.5-4.5.4

    Week #3 Slides:
    Pre-lecture version - Read
    Presentation version - Read


    Tutorial #3 (Feb. 1/2)

  • Tutorial Questions #1 - Download
    Please work out the solutions first before coming to the tutorial. The TA will give you 10 minutes to work on the questions if you have not already done so; and then the TA will work out the answers on the whiteboard. This will be followed by questions from you and answers from the TA. The hardcopy solutions will only be released after the quiz.

    Week #4 (Feb. 2, 3)

  • Table-Driven LR Parsers
  • Constructing the LR(k) State Machine
  • Items and the LR(0) Automaton
  • Canonical Collection of LR(0) Items
  • Closure Function
  • Goto Function
  • Valid Items
  • Constructing SLR Parsing Tables
  • Constructing Canonical LR Parsing Tables

    Reference:
    [ALS+07] 4.6.3; 4.6.2; 4.6.4-4.7.1

    Week #4 Slides:
    Pre-lecture version - Read
    Presentation version - Read


    Tutorial #4 (Feb. 8/9)

  • Tutorial Questions #2 - Download
    Please work out the solutions first before coming to the tutorial. The TA will give you 10 minutes to work on the questions if you have not already done so; and then the TA will work out the answers on the whiteboard. This will be followed by questions from you and answers from the TA. The hardcopy solutions will only be released after the quiz.

    Week #5 (Feb. 9, 10)

    Quiz #1 (Feb. 11)

  • Date: Feb. 11 (Thursday)
  • Time: 7:30-8:45 pm (1 Hr. 15 Mins.)
  • Venue: MMW706 (for students with surnames beginning from A - F)
    MMW710 (for the rest of the class)
  • Topics: Week #1 - Week #4 lectures + Tutorials #1 - #4 + Phase #1
  • Format: Open notes

    Week #5 Slides:
    Pre-lecture version -
    Read
    Presentation version -


    Week #6 (Feb. 15 - 19)

  • Lunar New Year holidays