CSE P 501 21au Compiler Construction
Information and Syllabus

Welcome back to in-person classes at UW! We’re following UW guidelines for courses this fall. In-person attendance in lectures is normally expected. We will be recording lectures on Panopto for review and to help catch up if you have an unavoidable absence, but this is not a distance-learning class that is intended to be taken remotely. Of course unexpected things can and probably will happen during the quarter. If you do need to miss class because of illness or other personal circumstances, please get in touch with the instructor or course staff so we can work with you to help with the situation, and get in touch as soon as you can so we can take care of things early when help will be most useful.

Please help each other by following UW guidelines about masking and refraining from eating and drinking in class (except for a sip of water now and then if needed). We all will need to do our best to work together and keep ourselves and others healthy. As circumstances change, we’ll adjust to follow UW and city, county, and state public health and other guidelines. Please stay flexible and speak up if you are having problems or if there are things that could be done better, and we’ll do our best to help.

Personnel

Instructor: Hal Perkins, CSE 548; 206-543-4784. Office Hours: after class plus whenever the door is open (including before class if I'm not cramming for lecture) or by appointment.

Teaching Assistant: Hannah Potter. Office hours Tuesdays 5:30-6:20 pm. CSE2 150.

If you need to contact the staff by email, please use the discussion board or send mail to csep501-staff[at]cs rather than to individual staff members It should help give you a faster response, and it helps us keep in touch with active issues.

Class Meetings

Tuesdays, 6:30-9:20 pm, CSE2 G10. There will be one additional class meeting on Thursday December 2 from 6:30-8:00 pm. for an exam. Details on that extra meeting will be announced later in the quarter.

Communications

The course web site is www.cs.washington.edu/csep501/.

We have an online ed discussion board (see message board link at the top of the page). Accounts will be set up for all registered students. Please use this to stay in touch outside of class and to help each other out. There is a link on the main course web page to read postings, and you can also adjust your profile to determine if messages are emailed to you. You can also use ed for private messages containing things like assignment details or other information that should not normally be posted publicly. Note that you need to use your UW Google identity to access the discussion board since membership is maintained automatically using UW's enrollment data for the class.

For other questions, including health issues or other personal circumstances, or for communications involving both you and your partner about the compiler project, please send mail to csep501-staff[at]cs. That will help us keep track of things that need further followup from the course staff to better help you.

Objective

The goal of the course is to understand how a modern compiler is structured and the major algorithms used to translate code from high-level to machine language. One of the best ways to do this is to actually build a working compiler, so there will be a significant project to implement one that translates programs written in a core subset of Java into executable x86-64 assembly language. The compilers themselves will use scanner and parser generator tools and the default implementation language is Java. Variations on the project may be possible; talk to the instructor if you want to try something different.

In most quarters, most of the students in CSE P 501 have not taken a previous compiler course, so we will cover the basics, but we'll move right along so we can get to more advanced material. Talk to the instructor if you are not sure whether this is the course for you.

Topics

Prerequisites

The nominal prerequisites for a compiler course are background equivalent to undergraduate courses in data structures and algorithms, formal languages and automata, and machine organization. Specifically:

We will review what we need of these topics, so it shouldn't be a problem if things are a bit rusty, and the textbook has good presentations of the core ideas. If you're missing one of the background courses, it is normally possible to work around it, but you will be on your own to fill the gaps. Talk with the instructor if you're not sure whether you have the appropriate background.

Texts

There are four good, fairly recent compiler textbooks available, none of which clearly dominates the others. Lectures and course materials will draw on all of them (among other sources). Most of these books have been used as the official text for the course at one time or another, and several of them would be suitable as a choice. We picked the Cooper/Torczon book as the recommended one because it seems to have the best balance between traditional and more recent material, but you are free to use whichever of these books you like.

The Cooper/Torczon book (at least) is available through Safari Books Online, and UW students have free access to all Safari books through the UW libraries. Go to https://www.oreilly.com/online-learning/, click sign-in at the top right, and sign in with your uw.edu email address to access them.

Assignments and Grading

The course will be oriented around the project, covering topics in the order needed for it. The project will be due in phases, both to keep you on schedule, and so we can give you feedback at crucial points to be sure that all is well.

We suggest you work on the project in groups of two. It is possible to work alone, but past experience has been that this is usually too much for one individual in a 10-week quarter (although some of the individual projects have been among the most impressive!). It is often very helpful to have a partner to talk with about specific details as the project evolves.

In addition to the project, there will be some written homework assignments to cover topics that don't fit into the project (particularly grammars and parsing at the beginning of the course, and some other topics later). There also will be a single exam late in the quarter. Assignments (and exams, of course) should be done individually.

The course grade will be computed roughly as follows:

The bulk of the project grade will be based on the final results at the end of the quarter, but we will take into account the quality and timeliness of the intermediate steps. The project will be graded primarily on how well it works, but reasonable code quality is expected - it'll be hard for you to do well or for us to evaluate your work without some attention to that. A short written report describing the project will be due at the end of the quarter. We may schedule brief group meetings with the course staff to talk about the project after everything is done, but this is not certain yet.

We reserve the right to adjust these percentages if it seems appropriate.

Computing Resources

You are free to use any computer, programming environment, and Java implementation that you wish. We do require that your code be standard Java, i.e., it will compile and run correctly with Java 11, which is the long-term-support version installed in the CSE labs for this quarter. If you have convincing reasons for wanting to use another implementation language, this might be possible. Please talk to the instructor first.

To execute the generated code you will need access to a programming environment that can compile and run a C bootstrap program and x86-64 assembly language code. The default environment is Rocky Linux gcc 9 and its associated assembler, and your code must assemble and run there when tested. The gcc toolchain is installed in the CSE instructional labs and a virtual machine image is available free for use on your personal machines.

All groups will be provided with a source code repository on the CSE GitLab server. You must store your project code there and course staff will retrieve projects from there for grading. You must not store your compiler or other homework solutions on any publicly accessible web site, repository, or other system.

Academic Integrity

This should go without saying, but it needs to be written down to avoid any misunderstandings.

Your project assignments should be done only by members of your group. Other assignments should be done by you alone, unless otherwise specified. If cases of academic misconduct are discovered we will pursue appropriate penalties under college and university rules.

However, we also want to be clear on what is legitimate collaboration -- please help each other out in this class in appropriate ways! It is OK to help other students debug their programs, and to discuss general approaches to solving problems. However, it is not OK to copy someone else's code or homework solution and turn it in as your own work - or to provide materials to others so they can do this. This also applies to using code or solutions from previous quarters of this course or other courses.

Exams must of course be done on your own. The exam will allow some use of notes and textbooks, with exact details to be specified.

Please refer to the separate academic integrity guidelines for more details. You are responsible for every word in that document as well as in this one.

Late Assignments and Incompletes

Assignments will be submitted online and are due at the time and date given in the assignment. We will try to be flexible about outside commitments (jobs, family events) that interfere with this. Please talk to the instructor if something happens that prevents you from submitting work on time.

Incompletes cannot be given simply because assignments were not done on time. They are only appropriate when circumstances outside your control prevent you from completing the course on schedule (illness, family emergency, etc.). Again, please talk to the instructor if something happens where this might be a necessary outcome.

Accommodations

Please refer to the university policies regarding accommodations and religous accommodations. Those policies apply in this class as everywhere else at UW. Please contact the instructor, DRS, or the course staff as needed so we can help.