News

  • 2012-01-09: You can use this old sample exam to see what kind of questions to expect. However there is no guarantee that the old exam covers all the material that will be included in this year's exam. It also may contain material that was not covered this year in class.
  • 2011-12-09: Task description for assignment 7 published.
  • 2011-12-09: Assignment 7 will be presented during the last half of the lecture on Monday, Dec 12.
  • 2011-11-28: Compiler fragment for Assignment 6 (CD1_A6) published. Please check your svn repositories.
  • 2011-11-26: Assignment 6 will be presented in class on Monday, Nov 28, at 10:15 am.
  • 2011-11-18: Next office hours for Assignment 5: Monday, November 21, 10:15-12:00 in RZ H3. Note that there are no office hours on Friday, November 25!
  • 2011-11-17: Code review sessions will take place during recitations on Nov 18.
  • 2011-11-14: Grades for Assignment1 (CD1_A1) published. Please check the 'GRADE' file in your svn repositories.
  • 2011-11-09: Compiler fragment for Assignment 5 (CD1_A5) published. Please check your svn repositories.
  • 2011-11-09: Task description for Assignment 5 available. The assignment and some hints will be presented on Thursday, Nov 10, at 10:15 am.
  • 2011-10-17: Task description for Assignment 3 available. The review will take place on Friday, Nov 18, from 1:15 - 4:00 pm. Check your email for the review location.
  • 2011-10-18: Compiler fragment for Asssignment 2 (CD1_A2) published. Please check your SVN repositories.
  • 2011-10-17: Task description for Assignment 2 available (fragment will follow soon). Assignment 2 will be explained in class on Thursday (Oct 20).
  • 2011-10-14: The next recitation session will be on Thursday (20th October) during the first half of the lecture. Monday will be a lecture as usual.
  • 2011-10-11: Lecture slides of September, 29: full version available.
  • 2011-10-10: Typo in task description for Assignment 1 corrected.
  • 2011-10-10: Next office hours: Friday, October 14, 13:15-16:00 in RZ H2.
  • 2011-09-29: Compiler fragment for Asssignment 1 (CD1_A1) published. Please check your SVN repositories
  • 2011-09-28: Task description for Assignment 1 available (fragment will follow soon). Assignment 1 will be explained during class on 10/3.
  • 2011-09-22: First meeting of class (there is no lecture on 9/19).
  • 2011-09-18: Team registration on-line. Please register your team until Wednesday, September 28.
  • 2011-09-18: Web site on-line.
  • Course overview

    This course uses compilers as example to expose modern software development techniques and introduces the students to the fundamentals of compiler construction. Students will implement a simple yet complete compiler for an object-oriented programming language for a realistic target machine. Students will learn the use of appropriate tools (parser generators); the implementation language is Java. Throughout the course, students learn to apply their knowledge of theory (automata, grammars, stack machines, program transformation) and well-known programming techniques (module definitions, design patterns, frameworks, software reuse) in a software project.

    The course covers: Compiler organization. Lexical analysis. Top-down parsing via recursive descent, table-driven parsers, bottom-up parsing. Symboltables, semantic checking. Code generation for a simple RISC machine: conditionals, loops, procedure calls, simple register allocation techniques.

    Course schedule

    Lectures are given in IFW A32.1 .

    The rooms for the recitation sessions will be announced later. Some of the lecture hours will be devoted to other activities (tutorials, reviews, etc) or will be devoted to group meetings. Please watch this page for updates and announcements.

    Tentative schedule of lectures

    This is a plan. No plan survives contact with reality.

    Week Monday Thursday
    0 09/22: Introduction, Admin issues
    1 9/26: Translation of assignment statements 9/29: Template-based code generation
    2 10/3: A1 Recitation: Code generator. Lecture: Evaluation order and register pressure 10/6: Front-end, overview
    3 10/10: Lexer, top-down parsers 10/13: Predictive top-down parsing
    4 10/17: Predictive top-down parsing 10/20: A2 Recitation: ANTLR (slides with individual builds, slides without individual builds, examples)
    5 10/24: 10/27 Bottom-up parsing I
    6 10/31: Bottom-up parsing II (SLR parsing), Semantic checking 11/3: Semantic checking
    7 11/7: Compile-time checking; Software quality approaches 11/10: A5 Recitation: Semantic analyzer. Lecture: Runtime system, data layout
    8 11/14: Method invocation, inheritance 11/17: Multiple inheritance
    9 11/21: No lecture. Office hours instead of lecture in RZ H3. 11/24: Code generation
    10 11/28: A6 Recitation: Code generator. Control structures, loops 12/1: Methods and functions
    11 12/5: Program analysis 12/8: Dataflow analysis I
    12 12/12: A7 recitation - Global Optimizations. Dataflow analysis II 12/15: Dataflow analysis III
    13 12/19: Dataflow analysis IV 12/22: Past & Future Trends

    Assistants

    Stephanie Balzer, RZ H 7
    Michael Pradel, RZ H 3
    Faheem Ullah, RZ H 2

    Questions

    To answer questions and discuss problems that you may encounter we offer office hours as well as a mailing list. These are:

    Please stick to the office hours and send technical questions only to the mailing list (and not directly to any of the assistants). Otherwise, make an appointment with one of the assistants.

    Assignments

    Assignments are an important part of the course. You will not learn this material from listening to a lecture alone -- you have to do the assignments.

    Note: Do not hesitate to write on the mailing list or make an appointment with your TA if you have trouble with the assignments!

    Some of the assignments ask you to extend a compiler skeleton implemented in Java. Any code fragments are distributed via subversion. Your solutions to the assignments must be submitted via subversion as well. Once you have registered a team, a directory will be made for you. The URL for your team is: https://svn.inf.ethz.ch/svn/trg/cd_students/2011hs/teams/<YourTeam>. You should log in with your nethz log in and password. If there are any problems please contact a TA immediately.

    Week Assignment Out Due Description Solution
    0 Choice of code generator target architecture 2011-09-22 2011-09-29 Assignment 0
    1 Simple code generator 2011-10-03 2011-10-17 Assignment 1
    4 Generating scanner and parser 2011-10-20 2011-11-07 Assignment 2
    7 SLR Parsing Table 2011-11-07 2011-11-18 Assignment 3
    7 Code Review 2011-11-07 2011-11-28 Assignment 4
    7 Symboltable and semantic check 2011-11-10 2011-11-28 Assignment 5
    10 Code generation 2011-11-28 2011-12-12 Assignment 6
    12 Global optimization 2011-12-12 2011-12-23 Assignment 7

    Grading

    66% of your grade is determined by homework (various assignments related to the topic of this course). 33% of the grade is determined by a written 1 hr exam.

    If you need to be away from Zurich during the exam period and cannot take the written exam, please contact the instructor by Nov 15. Depending on the number of exchange/visiting students, we may offer an alternative written exam in mid December.

    List of computer rooms with Linux installed

    Resources