CS 4470-001 Spring 2025 Compilers
CS 4470: Compilers
AEB 350, MW 11:50-13:10
(livestreamed and recorded via Zoom)
Instructors
Instructor: |
Ben Greenman <blg@cs.utah.edu> MEB 3252 |
TA: |
Bhargav Kulkarni <email TBD> office TBD |
Course Description
Overview
Course | CS 4470 |
Department | School of Computing |
Credit Hours | 3 |
Semester | Spring 2025 |
Outcomes
- Understand concepts in lexical analysis, and implement a lexer
- Understand how a programming language is represented by a grammar
- Understand LL and LR parsing, and write an LL parser
- Understand concepts in type checking, and implement a type checker
- Understand target-independent program optimizations, and implement several relatively simple optimizations
- Understand code generation, and implement generation of x86-64
Materials
There are no required materials / textbooks.
Optional reading:
- Cooper & Torczon. Engineering a Compiler. 2nd edition. ISBN13 9780120884780
Communication
Office Hours
TBD
Evaluation
- Grades will be assigned on a 90/80/70/60 scale,
- We reserve the option to curve raw scores before assigning grades if they judge that students’ numeric performance is not representative of the grades they deserve.
- Grade components
- 70% programming assignments
- 20% in-class participation, though presentations and discussions
- Contact the instructor if in-class participation is a major barrier
- 10% quizzes, including course evaluations.
There will be no exams. No midterms, no final.
Teaching and Learning Methods
Class time will be used for lecture and discussion. We’ll spend a lot of time looking at compiler code in class: some of it written by students, some by the instructors, and some by compiler developers in industry. Outside of class, most of your time will be spent implementing a compiler for a language called JPL (designed to provide a relevant, challenging, and interesting learning experience). The instructors will provide extensive test cases to guide your journey toward a correct compiler. Writing compiler code is the most effective way to learn about how compilers work.
Students will build a real compiler, in stages, throughout the semester. Subsequent assignments will build upon early ones. Do a good job each week to avoid falling behind.
Course Policies
Late work: Assignments are due weekly at 5pm on Fridays. Late submissions are allowed until the start of class on Monday without penalty. We will not accept submissions after class starts.
Participation: We strongly encourage your participation in both in-class discussions and online forums. The instructor will provide a welcoming environment in which we understand that all code has bugs and the goal is to find more bugs, not to criticize the bugs author.
Online: We will use Canvas, Discord, and GitHub. Online discussion will center on Discord. All programming artifacts will live on GitHub. Canvas will record whatever things must be in Canvas.
Academic Misconduct: We follow the Kahlert School of Computing policy. See below. Academic dishonesty results in a failing grade for the course. Two instances of academic dishonestly lead to expulsion from the major.
Zoom: Lectures will be streamed on zoom and recordings will be available on Canvas for several weeks. Zoom attendance is allowed but not encouraged. We will not actively monitor the chat. We are unlikely to allow audio from participants (the host machine will probably be muted). The positioning of the recording camera and microphone may be poor. Our goal with the recordings is to allow anyone to catch up with class for any reason it might be necessary (no questions asked), but without detracting from the in-person experience where audio/video choppiness ("oops i was muted", etc, etc.) is much less of a problem.
AI + LLM: You may use AI tools (including but not limited to ChatGPT, GitHub Copilot, Llama, Claude, etc. etc.) for any part of this course. You must cite the AI contributions to your work and you must take full responsibility for the outputs. Failure to do so may result in a zero for the assignment and an academic integrity case. Beware that AI tools may produce wrong and misleading output, and beware that their cost to the environment may not be factored in to their usage price.
Schedule
[2024-12-13: tentative schedule, subject to change]
Week | Monday | Wednesday | Homework |
1 | Intro + JPL | Lexing | JPL examples |
2 | ASTs, structural recursion | Sequences | Lexing |
3 | Parsing LL(1) vs LR(1) | Converting to LR(1) | Parsing prefix |
4 | Precedence / associativity | Disambiguation | Parsing postfix |
5 | Types & type rules | Typechecking | Parsing infix |
6 | Symbol table & names | Resolving types | Typing expressions |
7 | IRs | IR Compilation | Typing contexts |
8 | Runtimes | Correctness | IR expressions |
9 | Data types | Registers & memory | IR control flow |
10 | N/A, happy spring break | N/A | N/A |
11 | Object files | Linking & loading | Assembly |
12 | Optimization basics | Peephole optimization | Calling conventions |
13 | Dataflow analysis: lattices | Dataflow analysis: fixpoints | Peephole optimization |
14 | Memory hierarchy | Access patterns | Constant folding |
15 | Vectorization: idea | Vectorization: masking | Loop ordering |
16 | TBD | TBD | TBD |
Support
Accommodations will be considered on an individual basis and may require documentation.
Please contact the instructor as soon as possible (preferably shortly before the semester begins) to request accommodations of any kind.
Contact your instructor as soon as possible if an extreme personal circumstance
(hospitalization, death of a close relative, natural disaster, etc.) is interfering with your ability to
complete your work.
To request an accommodation for religious practices, contact your instructor at the beginning of the semester.
If you are student on active duty with the military and experience issues that prevent you from participating in the course because of deployment or service responsibilities, contact your instructor as soon as possible to discuss appropriate accommodations.
Disability Access
All written information in this course can be made available in an alternative format with prior notification to the Center for Disability Services (CDS). CDS will work with you and the instructor to make arrangements for accommodations. Prior notice is appreciated. To read the full accommodations policy for the University of Utah, please see Section Q of the Instruction & Evaluation regulations.
If you will need accommodations in this class, contact:
Center for Disability Services
801-581-5020
disability.utah.edu
162 Union Building
200 S. Central Campus Dr.
Salt Lake City, UT 84112
Office of Equal Opportunity
The Office of Equal Opportunity And Affirmative Action (OEO/AA) is dedicated to providing a fair and equitable environment for all to pursue their academic and professional endeavors and to equally access University programs.
OEA/AA
801-581-8365
oeo.utah.edu
383 South University Street
Level 1, OEO Suite
Salt Lake City, UT 84112
Price College Counseling Service
Goal: provide a confidential, safe, and non-judgmental space to address any stressor or concern in your life. Empower you to take actions to meet your needs, values, and goals.
Call to schedule an Initial Consultation (IC) appointment. Be sure to ask for “embedded counseling for College of Engineering”.
Counseling Center
801-581-6826
www.price.utah.edu/students/current/counseling
WEB 1707