CS712/CS812
Compiler Design
Summer 2023
Tue/Thur 6:00pm-7:30pm, ZOOM Meetings


Instructor
Catalog Description
Learning Objectives
Disability Services
Emotional or Mental Health Distress
Grading
Computer Accounts
Suggested Readings
UNH Online Platform Registration If you aren't already a member of the CS Dept. Online server (Discord) We will be using this for class this term.
UNH CS Gitlab Submissions are made through the UNH CS Gitlab, with starter code available to be forked from my account
Starter code All starter code for this course will be available here, and you should fork from this repo for initial course setup.
Course GitLab Setup

Programming Project: Phase 1
Programming Project: Phase 2
Programming Project: Phase 3
Programming Project: Phase 4

Instructor

Sawyer Bergeron
Office: CS Dept Online Platform (Discord)
E-mail: Sawyer.Bergeron@usnh.edu
Office Hours: Tue/Thu 3:30-4:30pm or by appointment (send e-mail to request an appointment).

Catalog Description

Techniques for syntax analysis (including parsing theory, error recovery), program representation (syntax trees, IRs, SSA form), naive code generation and middle-end semantic analysis. Implementation of features from imperative and object-oriented languages. Students required to design and implement a compiler for a simple language.

This is an implementation-intensive course. (Note: this course no longer counts as a theory course.)

The prerequisite for this course is CS520.
It is really helpful if you have had CS659, some topics discussed in CS761/CS671 are relevant for intuitive understanding of some features implemented during this course.

Learning Objectives

Disability Services

According to the Americans with Disabilities Act (as amended, 2008), each student with a disability has the right to request services from UNH to accommodate his/her disability. If you are a student with a documented disability or believe you may have a disability that requires accommodations, please contact Student Accessibility Services (SAS) at 201 Smith Hall. Accommodation letters are created by SAS with the student. Please follow-up with me as soon as possible to ensure timely implementation of the identified accommodations in the letter. I have an obligation to respond once I receive official notice of accommodations from SAS, but am under no obligation to provide retroactive accommodations.

For more information refer to www.unh.edu/studentaccessibility or contact SAS at 603.862.2607, 711 (Relay NH) or sas.office@unh.edu.

Emotional or Mental Health Distress

Your academic success in this course is very important to me. If, during the semester, you find emotional or mental health issues are affecting that success, please contact Psychological and Counseling Services, which provides counseling appointments and other mental health services.

Grading

The major portion (64%) of your course grade will be based upon a large project. You will implement a compiler for a significant subset of the T programming language. The translator will be written in Java. You will use the ANTLR parser generator and the LLVM tools to generate x86_64 assembly language.

The project will consist of 4 phases:

Each project assignment will be worth 16% of the course grade and consist of 100 points. Assignments are due at midnight on the day they are due, but there is a ten-hour grace period until 10am the next day. Late penalties here are selected based on the fact that every phase builds on prior phases. If variables from phase 1 do not work, arrays for phase 2 can not be tested, and so on. Individual exceptions adjustments will not be made outside of extraordinary circumstances. If any adjustment occurs, it will be class-wide, with those who submitted on the original due date receiving additional credit. Project assignments may be handed in late at a penalty of 2 points for one day late, 5 points for two days late, with every additional day late subtracting an additional 7 points. (3 days is -12, 4 is -21). The ten-hour grace period is in effect for the late submissions as well.

Project Architecture Pragmatism

The project is cumulative. You must live with your code for the whole semester. Solutions for phases will not be given out. Regression testing is critical.

Note that while many tests are provided for each phase, there are a number of tests that are used for grading that are not published until after each phase is completed. You should construct your compiler defensively, handling "bad input" and "weird situations" gracefully.

Compilers in the wild are implicitly relied on for fundamental soundness. Even though your compilers are not themselves going to be relied on for the next aerospace guidance system or nuclear power plant control system, it's very important to understand even how inconvenient and infuriating a compiler bug can be given how widely used they are and how much trust is placed in them. Grades for this course are rather lenient toward even soundness bugs, but these hidden inputs will hopefully reinforce the importance of architectural soundness and complexity reduction. Don't be afraid to rewrite part of your project if you realize you made an incorrect assumption, don't be afraid to change the starter code to fit a more intuitively sound model of T.

WARNING: To get full credit on a programming assignment, your code must be adequately documented and structured. If I can't easily read and understand your code, you may lose points!

Checkpoints

The bulk of the remainder of your grade is comprised of four project checkpoints, each worth 8% of your final grade. Each checkpoint serves as a chance to review implementation approaches and assess project progress. These checkpoints do not rely on completion of the project phase they correspond to, but are designed to clear up conceptual concerns and to form a deeper understanding of the approaches discussed in class as they apply to the project. Each checkpoint is to be scheduled within two weeks after the due date of the corresponding project phase. They are preferred to be done as a ~20 minute meeting (in person or over Zoom), however alternative textual completion options (write-up form with a chat component) may be arranged at student request. These are not designed to be interrogative, and are instead an opportunity for you, the student, to walk me through your process and your design. Extra credit opportunities may exist for students who wish to present novel approaches to construction of their compiler--or novel approaches to compiler construction in general--to the class.

The rest (4%) of your course grade will be based upon class participation. Students should feel encouraged to participate in class discussions, ask questions where there are conceptual gaps (I don't always know what other people don't know), and bring outside information into class. Compiler and language design are both surprisingly fluid fields at this time, with many major advancements and new languages that attempt to fill "stale" or novel niches. These advancements are useful context to ground the theory discussed in class, so students should feel free to bring articles/projects/posts to class, and to volunteer approaches so they can be discussed.

Collaboration Policy

WARNING: All students are expected to do their own work on the programming assignments. No collaboration on the compiler project is allowed. A general rule to follow is that you may discuss the programs with other students at the concept level but never at the coding level. If you are at all unclear about this general rule, don't discuss the programs with other students at all.

In summary, your course grade will be determined in the following way:

Final course grades (FOR UNDERGRADS) will be assigned in the following way:

If you are taking this course for graduate credit, the expected level of your work is higher.
Please note that I do not round percentages up. So, 84.95% is a B+ and not an A-.

Computer Accounts

The UNH CS server agate.cs.unh.edu is the primary computing resource for this course. You should automatically be given an account on this machine. During the semester you may use any other machines that you have access to, but for grading purposes your programs must execute on agate.cs.unh.edu.


Last modified on May 12, 2023.

Comments and questions should be directed to Sawyer.Bergeron@usnh.edu.