CS2210: Compiler Construction

Spring 2012


Prerequisites

CS 1621: Structure of Programming Languages

Objectives

The design and implementation of current high level languages. Emphasis is placed on the structure of compilers. Lexical, syntax and semantic analyses as well as target code generation and register allocation. Storage management techniques for recursive and retentive control structures. Formal specification techniques.

Instructor

Youtao Zhang <zhangyt AT cs dot pitt dot edu>

Office hours: MW 2:00pm-4:00pm, Room SENSQ 6407

TA and TA Office Hours

Mr. Jiannan Ouyang < ouyang AT cs dot pitt dot edu>

Office hours: Monday and Wednesday 3pm - 5pm, Room SENSQ-6805

Announcement

04/16/2012: Homework 3 assigned.
02/12/2012: Homework 2 assigned.
02/12/2012: Project 2 assigned.
02/03/2012: TA office hours updated.
01/18/2012: Homework 1 assigned.
01/11/2012: Project 1 assigned.
01/2/2012: Class webpage online.

Exams

1.

Midterm exam: Time: Feburary 29th, 2012, class time, closed-book,closed-notes.

  • Review1.pdf
  • 2.

    Final exam: Time: April 23, 2012, class time, closed-book,closed-notes.

    Homework

    1.

    Homework #1: hw1.pdf

    2.

    Homework #2: hw2.pdf

    3.

    Homework #3: hw3.pdf Due Time: April 23st, 2012.


    Projects

    1.

    Project1 (Lexicial Analyzer)

  • Project description (.pdf).
  • Lex manual(.pdf).
  • Sample code(mylex.l, token.h).
  •   #> lex mylex.l

      #> gcc -ll mylex.yy.c -o mylex

      #> mylex < Sample.txt

  • Grading checklist(.pdf).
  • Test Cases(test1.mjava,test2.mjava).
  • 2.

    Project2 (Syntax Analyzer)

  • Project description (.pdf).
  • YACC manual(.pdf).
  • Provided files(proj2.c,proj2.h).
  • Sample parser( parser for Linux, parser for SunOS ).
  • Sample input( ex1,ex2,ex3,ex4,ex5, ex6,ex7,ex8,ex9,ex10).
  • #> ./parser < ex1
  • Grading checklist(.pdf).
  • 3.

    Project3 (Semantic Analyzer)

  • Project description (.pdf).
  • Provided files(proj3.c,proj3.h).
  • Sample checker( checker for Linux, checker for SunOS ).
  • Sample input( err1,err2,err3,err4,err5).
  • #> ./seman < err1
  • Grading checklist(.pdf).
  • 4.

    Project4 (Code Generator) Due time: April 22nd, 2012.

  • Project description (.pdf).
  • Spim Simulator (spim on linux)
  • Sample generator( generator running on linux, trap.handler )
  • MIPS ref card (.pdf).
  • Sample input( src1, src2, src3, src4, src5, src6, src7, src8, src9, src10).
  • #> ./codeGen < src1
  • #> ./spim -file code.s
  • Topics

    Course syllabus (.pdf)

    1.

    Introduction (slides,handout).

    2.

    Lexical Analysis (slides,handout).

    3.

    Syntax Analysis (slides,handout, part2).

    4.

    Semantic Analysis (slides,handout).

    5.

    Code Generation (slides).

    6.

    Runtime Management (slides).

    7.

    Optimization (slides, Advanced topic 1 (PRE), Advanced topic 2 (Loop Transformation)).

    Textbook

    Alfred V.Aho, Monica Lam, Ravi Sethi and Jeffery D.Ullman, Compilers: principles, techniques and tools, 2nd Edition, 2006, Addison-Wesley Publishing Company.

    Grading

    Homework (20%)

    Projects (30%)

    Midterm Exam (20%)

    Final Exam (30%)

    Policies

    1.

    Academic Integrity

    You may discuss assignments with classmates, but the work you turn in must be your own. If in doubt, refer to the university's policies or ask the instructor. The minimum penalty for a violation of the code will be a zero for the assignment in question; the maximum penalty will be failure of the course.

    2.

    No Smartphone/Social Network

    No computer/laptop/smartphone is needed during the lecture time. Logging into social network is prohibited. Please talk to the instructor for permission if you need to use a computer to take notes.

    3.

    Exam

    All exams must be taken in class on the date they are given. There will be no exceptions unless you have a very good reason and have received permission in advance.

    4.

    Assignment Due Time

    The due time of homework and projects is the beginning of the class time. Late submissions incur a penalty of 10% per day.

    5.

    Disability

    If you have a disability for which you are or may be requesting anaccommodation, you are encouraged to contact both your instructor and Disability Resources and Services, 216 WilliamPitt Union, (412) 648-7890/(412)383-7355 (TTY), as early aspossible in the term. DRS will verify your disability and determine reasonable accommodationsfor this course.