Vikram S. Adve

Donald B. Gillies Professor | Computer Science Department|University of Illinois at Urbana-Champaign

CS 426 — Compiler Construction


Fall 2025

09:30-10:45 Tuesdays and Thursdays, 0216 SC

Course Number 43355 (3 hours) / 43356 (4 hours)


Teaching Staff

Statement on CS CARES and CS Values and Code of Conduct

    All members of the Illinois Computer Science department – faculty, staff, and students – are expected to adhere to the CS Values and Code of Conduct. The CS CARES Committee is available to serve as a resource to help people who are concerned about or experience a potential violation of the Code. If you experience such issues, please contact the CS CARES Committee. The instructors of this course are also available for issues related to this class.

Course Content

    The purpose of this class is to examine the design and implementation of an optimizing compiler. Students will learn about common optimizations, intermediate languages, and design choices in lecture and will learn about the software engineering challenges of implementing a compiler for an imperative, object-oriented language in machine problems.

Assignments

    Students will complete two homeworks, four machine problems, an unit project (for 4 credits only) throughout the course. There will also be a midterm and a final exam. Each machine problem will build on the previous one, so it is expected that students will write maintainable code for assignments.

Textbook

Either of the following books provides good coverage of many topics in the course.
  • Engineering a Compiler by Cooper and Torczon, published by Morgan Kaufman. Copies of this book are on reserve at Grainger Engineering Library.
  • Compilers – Principles, Techniques, and Tools (2nd Edition) by Aho, Lam, Sethi, and Ullman, published by Addison-Wesley. This is the well known “dragon book.” Please note that we are using the recently released second edition of the book. The first edition is out of date. Copies of this book are on reserve at Grainger Engineering Library.

Additional Reading

  • Advanced Compiler Design and Implementation by Steven S. Muchnick, published by Morgan Kaufmann. This book provides detailed descriptions of many analysis and optimization passes, and some useful case studies of real-world compilers. Copies of this book are on reserve at Grainger Engineering Library. If you happen to buy this book, try to get the latest printing, since it has the fewest errors.
  • One or more selected papers. These will be available via the Papers link at the left.

Course Newsgroup

For questions to the instructors and discussions among students we have set up a forum on Piazza. This is an external website not affiliated with the University of Illinois.

NOTE: No solutions or code should be posted by students on the newsgroup. Only the instructors may post solutions or hints.

Lecture Notes

    Copies of the slides used in class will be posted on the course Web page before each class. This way, you do not need to copy down material on the slides. Nevertheless, you should take detailed notes during the lectures.

    NOTE: The slides are generally sparse, containing only brief bullets on key points. For example, they are insufficient for studying for exams. This is why you should be sure to take notes during the lectures.

Homeworks and Exams

    There will be two homeworks and two exams, spaced out over the course of the semester. The midterm exam will be in class and the date will be announced shortly. The final exam will be at the normal time scheduled by the University for our class slot.

Project Description

    This class has a semester project divided into four MPs. Graduate students who are taking the course for 4 credit hours (hereinafter, and without loss of generality, referred to as 1-unit students) will be required to do a fifth and more substantial part during roughly the second half of the semester. The broad goals for the project are described on the course project page.

Grading Policy

    UG or 0.75 unit gradsUnit Project(4 credits)
    MP1-MP440%32%
    Homeworks20%16%
    Midterm15%12%
    Final25%20%
    Unit ProjectN/A20%

    Project grading

    The core programming project will be due in four parts, and will be graded as the semester progresses.
    • For 3-credit-hour students, the project carries 40% of the grade, allocated as: MP1: 6%, MP2: 10%, MP3: 12%, MP4: 12%.
    • Only 1-unit (i.e., 4-credit-hour) students must do the unit project, which has a total weighting of 20% of their semester grade.
    • For 1-unit students, the total score for the semester can be computed by scaling all the basic course components by 0.8, and giving the unit project a weighting of 0.2, i.e.,
      Total = 0.8 * BasicTotal + 0.2 * UnitProjectScore
    • Graduate students will be assigned final course grades separately from undergraduate students (but all scoring of course components will be common).

    Grad students vs. undergrads

    Graduate students will be graded separately from undergraduate students.

Computing Facilities

  • We will allocate a virtual machine (VM) for each one of you. You can work on your programming assignments (MPs 1-5) on this VM, and you will need it for submitting these assignments.
  • Go to this page UIUC VPN Download and download the VPN. Make sure connect to the campus network.
  • Connect to the VPN
  • Visit https://vc.cs.illinois.edu/ui and log in with your university credentials.
  • Power on your VM and ssh into your VM using the instructions given here: https://answers.uillinois.edu/illinois.engineering/page.php?id=108475
  • Everyone should review the university’s VM farm policy before using your VM: https://answers.uillinois.edu/illinois.engineering/page.php?id=104597
  • Particularly to note: your VM automatically shuts down everyday at 5 AM (all saved files will stay intact). Remember to power it on before using and save your progresses as you go.

General Course Policies

Second-chance Submissions

  • For all MPs (except MP1), students may submit a second version of their solution up to one week after the original due date.
  • The final score for the MP will be calculated as max(First-Score, 0.9 * Second-Score) - Late-Penalty (where LatePenalty is the late penalty for the first submission, as detailed in the section Lateness).
  • The first submission is required. Another way to put it is that the late penalty will accumulate to 100% within a week, so a lack of a first submission will net you 0 points.
  • No late submissions will be accepted for the second submission.

Incomplete MPs

  • 10 points are reserved for completely working MPs with no significant errors. So if your MP is not working (with respect to the test files we use), expect to lose 10 points right away.
  • All the MPs (except the first one) are dependent on the previous ones. If you could not get a previous MP working, and don’t want to finish it before you start on the next one, then you can get the previous MP solution from a TA but with a penalty of 10% on the next one. For example, in MP3 you are supposed to use your MP2 solution and if you could not get MP2 working before starting on MP3, you can get our code for MP2 from a TA, but you will be penalized 10% on MP3. Though this means you will be penalized twice for not finishing an MP, an important aspect of this project is building a working compiler, not just building a piece, then throwing it away before building the next one.

Lateness

  • Late programming assignments will be penalized 1% of total available points (e.g., 1 point out of 100) per hour late (or fraction thereof), counted from 5pm on the due date. This means being several hours late could significantly affect your grade.
  • There are two circumstances for which we’ll give “free” extensions:
    • Serious personal problems. These will be dealt with individually. They are typically either serious illness to you (doctor’s verification required) or a major family emergency.
    • Extended lab downtime. This is extremely rare. A whole day of downtime in the lab might qualify. Minor downtime does not qualify. “Flakiness all weekend” does not qualify. Accidental loss of files does not qualify. If you have chosen to work on some other machine other than the designated class machines, then you do so at your own risk. To protect yourself, keep recent backups on the class machines so that if your machine breaks, you can recover.

LLM Usage Policy

Use of LLMs for the submitted files
  • If you used a prompted code generator, such as GPT-4, annotate every block of code that was assisted by the code generator (even if you further edited the code generator’s output). You should label and number each such code block with comments (e.g., /* LLM Block 1 */) and clearly indicate the start/end line of the block. Comment at the end of the file on (1) the tool you used (GPT-3.5, GPT-4, etc.) and (2) the full prompt you gave to the tool, for each code block.
  • If you used an unprompted code generator, such as GitHub Copilot, comment at the beginning of each file the name of the tool you used, and indicate any large block of code (≥ 5 lines) you got from the tool.
  • We will manually check these comments and may try to reproduce some of the code generation results with your prompts.
Use of LLMs for the unsubmitted files
  • You may use LLMs for summarizing and understanding unsubmitted files, including the handout PDFs and source code. You do not need to disclose these uses.
  • You may also use LLMs for creating test cases for your MPs, with some restrictions:
    • You may NOT use LLMs to create a testing strategy, only to create individual test cases.
    • You MUST disclose these uses. In particular, add a prominent comment at the beginning of at least one of your submitted source files stating:
      1. How many test cases you generated.
      2. What functionality you tested using those test cases.
      3. The exact prompt(s) you used to generate the test cases.
Testing Strategy
  • Testing is a critical part of compiler development and learning to generate good quality, comprehensive test cases is a key goal of the projects. Think carefully about your testing strategy, including coverage, unit tests, and other feature tests. (Regression testing is not technically needed for the semester project because your code will be short-lived, but it is another essential feature of real compiler projects.) This is why you may use LLMs to speed up writing individual tests but NOT for creating an overall testing strategy.

Cheating

  • You are NOT to copy solutions from ANY source (including, but not limited to, books, people, old class notes or handouts). While the pressures of many classes, homeworks, work and/or extracurricular activities can be great, this is never an excuse for copying solutions from others. “Helping” somebody by allowing them to “borrow” your homework is not doing them a favor either, but indicates your approval and active participation in such activities. Refer to the Campus Code regarding academic integrity. A first offense will result in a zero on the assignment or exam, as well as reducing the overall course grade by a whole letter grade. If you are aware of any breach of academic integrity, it is your responsibility to report it to the instructor.

Discussing your problems with other students, however, is encouraged and even highly recommended. This means asking someone to look at parts of your code to give you advice, asking them for suggestions when you face an obstacle, working out example exercises together that are not on an assigned homework, or just discussing any aspect of the material. What you may not do is to copy or in any way use code or homework solutions written by anyone else or dictated by anyone else. As responsible adults, you can draw the distinction between cheating and honest behavior: exercise your judgement and try to preserve the highest level of professional integrity in everything you do.

Bottom line: You may discuss difficulties with others and get occasional help with debugging but you must write your code entirely by yourself.

How to Get the Most out of this Course

  1. Read the text as it is quite thorough, with many examples worked out, good motivating discussions, and useful intuition.
  2. Participate actively in class: ask questions when you don’t understand something, and share in the in-class exercises.
  3. Do the homeworks and project assignments ahead of time whenever possible. Working madly to beat a deadline is a terrible way to learn!