IU-Fall-2021

Course web page for Fall 2021.

View the Project on GitHub IUCompilerCourse/IU-Fall-2021

Course Webpage for Compilers (P423, P523, E313, and E513)

Indiana University, Fall 2021

High-level programming languages like Racket and Python make it easier to program compared to low-level languages such as x86 assembly code. But how do high-level languages work? There’s a big gap between high-level languages and machine instructions for modern computers. In this class you learn how to translate Racket or Python programs (your choice!) all the way to x86 assembly language.

Traditionally, compiler courses teach one phase of the compiler at a time, such as parsing, semantic analysis, and register allocation. The problem with that approach is it is difficult to understand how the whole compiler fits together and why each phase is designed the way it is. Instead, each week we implement a successively larger subset of the input language. The very first subset is a tiny language of integer arithmetic, and by the time we are done the language includes first-class functions.

Prerequisites: Fluency in Racket or Python is highly recommended as students will do a lot of programming in one of those languages. Prior knowledge of an assembly language helps, but is not required.

Textbook: Essentials of Compilation

If you have suggestions for improvement, please either send an email to Jeremy or, even better, make edits to a branch of the book and perform a pull request. The book is at the following location on github:

https://github.com/IUCompilerCourse/Essentials-of-Compilation

Lecture: Tuesdays and Thursdays 3:15-4:30pm, Informatics Building (Myles Brand Hall), Room E130.

Office hours

Topics:

Grading:

Course grades are based on the following items. For the weighting, see the Canvas panel on the right-hand side of this web page. Grading will take into account any technology problems that arrise, i.e., you won’t fail the class because your internet went out.

Assignments:

Organize into teams of 2-4 students. Assignments will be due bi-weekly on Mondays at 11:59pm. Teams that include one or more graduate students are required to complete the challenge exercises.

Assignment descriptions are posted on Canvas. Turn in your assignments by submitting your code to the autograder. There is a Racket and Python version of each assignment. Submit your compiler file, either compiler.rkt or compiler.py depending on the language you are using.

Assignments will be graded based on how many test cases they succeed on. Partial credit will be given for each “pass” of the compiler. Some of the tests are in the public support code (see Resources below). The testing will be done on a linux (ubuntu) machine. The testing will include both new tests and all of the tests from prior assignments.

You may request feedback on your assignments prior to the due date. Just submit your work to the autograder and send us email.

Students are responsible for understanding the entire assignment and all of the code that their team produces. The midterm and final exam are designed to test a student’s understanding of the assignments.

Students are free to discuss and get help on the assignments from anyone or anywhere. When posting questions on Slack, it is OK to post your code.

In contrast, for quizzes and exams, students are asked to work alone. The quizzes and exams are closed book.

The Final Project is due Dec. 10 and may be turned in late up to Dec. 15.

Late assignment policy: Assignments may be turned in up to one week late with a penalty of 10%.

Slack Chat/Messaging: Workspace ( signup using your iu email address).

Schedule

Day Lecture Topic Reading Due Assignment Due
Aug. 24 Introduction    
Aug. 26 Compiling from LVar to x86 Ch. 1  
Aug. 31 Uniquify, Remove Complex Operands, Explicate Control Ch. 2  
Sep. 2 Select Instructions, Assign Homes, Patch Instructions, Prelude & Conclusion    
Sep. 6     Integers and Variables, submit in Racket or Python
Sep. 7 Register Allocation: liveness analysis, interference graph    
Sep. 9 Code Review: Integers and Variables Ch. 3  
Sep. 14 Register Allocation: graph coloring    
Sep. 16 The LIf language & type checking    
Sep. 20     Register Allocation, submit in Racket or Python
Sep. 21 Code Review: Register Allocation Ch. 4  
Sep. 23 Compiling LIf to x86    
Sep. 28 Compiling LIf to x86, cont’d    
Sep. 30 Loops and Dataflow Analysis    
Oct. 4     Booleans and Conditionals, submit in Racket and Python
Oct. 5 More Dataflow Analysis    
Oct. 7 Code Review: Conditionals    
Oct. 12 Loops: RCO, Explicate, Remove Jumps    
Oct. 14 Tuples and Garbage Collection    
Oct. 18     Loops and Dataflow Analysis, submit in Racket or Python
Oct. 19 Review for Midterm    
Oct. 21 Midterm Exam    
Oct. 26 Tuples and GC, cont’d    
Oct. 28 Tuples and GC, cont’d    
Nov. 2 Compiling Functions to x86    
Nov. 4 Compiling Functions, cont’d    
Nov. 8     Tuples and Garbage Collection, submit in Racket or Python
Nov. 9 Example: Simple Call    
Nov. 11 Examples: Tail Calls, Many Parameters    
Nov. 16 Compiling Lambda    
Nov. 18 Examples of Closure Conversion    
Nov. 29     Functions, submit in Racket or Python
Nov. 30 Code Review: Functions    
Dec. 2 Dynamic Typing    
Dec. 7 Dynamic Typing, continued    
Dec. 9 Review for Final Exam    
Dec. 14 Final Exam 12:35-2:35 p.m. in class    

Resources:

COVID Policies and Precautions

All students signed the Community Responsibility Acknowledgement (CRA). Your agreement to the public health measures in the CRA is a condition of physical presence on the campus this fall. Included in that commitment were the requirements to be vaccinated, for wearing masks in all IU buildings, and maintaining social distancing in all IU buildings. These are classroom requirements.

These requirements are necessary for us to protect each other.

Therefore, if a student is present in a class without a mask, the student will be asked to put on a mask and I will report the student to the Division of Student Affairs: Office of Student Conduct.

Bias-Based Incident Reporting.

Bias-based incident reports can be made by students, faculty and staff. Any act of discrimination or harassment based on race, ethnicity, religious affiliation, gender, gender identity, sexual orientation or disability can be reported through any of the options:

1) email biasincident@indiana.edu or incident@indiana.edu;

2) call the Dean of Students Office at (812) 855-8188 or

3) use the IU mobile App (m.iu.edu). Reports can be made anonymously.

Dean on Call.

The Dean of Students office provides support for students dealing with serious or emergency situations after 5 p.m. in which an immediate response is needed and which cannot wait until the next business day. Faculty or staff who are concerned about a student’s welfare should feel free to call the Dean on Call at (812) 856-7774. This number is not to be given to students or families but is for internal campus use only. If someone is in immediate danger or experiencing an emergency, call 911.

Boost.

Indiana University has developed an award-winning smartphone app to help students stay on top of their schoolwork in Canvas. The app is called “Boost,” it is available for free to all IU students, and it integrates with Canvas to provide reminders about deadlines and other helpful notifications. For more information, see https://kb.iu.edu/d/atud.

Counseling and Psychological Services.

CAPS has expanded their services. For information about the variety of services offered to students by CAPS visit: http://healthcenter.indiana.edu/counseling/index.shtml.

Disability Services for Students (DSS).

The process to establish accommodations for a student with a disability is a responsibility shared by the student and the DSS Office. Only DSS approved accommodations should be utilized in the classroom. After the student has met with DSS, it is the student’s responsibility to share their accommodations with the faculty member. For information about support services or accommodations available to students with disabilities and for the procedures to be followed by students and instructors, please visit: https://studentaffairs.indiana.edu/disability-services-students/.

Reporting Conduct and Student Wellness Concerns.

All members of the IU community including faculty and staff may report student conduct and wellness concerns to the Division of Student Affairs using an online form located at https://studentaffairs.indiana.edu/dean-students/student-concern/index.shtml.

Students needing additional financial or other assistance.

The Student Advocates Office (SAO) can help students work through personal and academic problems as well as financial difficulties and concerns. SAO also assists students working through grade appeals and withdrawals from all classes. SAO also has emergency funds for IU students experiencing emergency financial crisis https://studentaffairs.indiana.edu/student- advocates/.

Disruptive Students.

If instructors are confronted by threatening behaviors from students their first obligation is to insure the immediate safety of the classroom. When in doubt, call IU Police at 9-911 from any campus phone or call (812) 855-4111 from off-campus for immediate or emergency situations. You may also contact the Dean of Students Office at (812) 855-8188. For additional guidance in dealing with difficult student situations: https://ufc.iu.edu/doc/policies/disruptive-students.pdf.

Academic Misconduct.

If you suspect that a student has cheated, plagiarized or otherwise committed academic misconduct, refer to the Code of Student Rights, Responsibilities and Conduct: http://studentcode.iu.edu/.

Sexual Misconduct.

As your instructor, one of my responsibilities is to create a positive learning environment for all students. Title IX and IU’s Sexual Misconduct Policy prohibit sexual misconduct in any form, including sexual harassment, sexual assault, stalking, and dating and domestic violence. If you have experienced sexual misconduct, or know someone who has, the University can help.

If you are seeking help and would like to speak to someone confidentially, you can make an appointment with:

It is also important that you know that Title IX and University policy require me to share any information brought to my attention about potential sexual misconduct, with the campus Deputy Title IX Coordinator or IU’s Title IX Coordinator. In that event, those individuals will work to ensure that appropriate measures are taken and resources are made available. Protecting student privacy is of utmost concern, and information will only be shared with those that need to know to ensure the University can respond and assist. I encourage you to visit stopsexualviolence.iu.edu to learn more.