gjRqwQuAGjiEgIVrApDscQ==2025-05-04T11:29:25Zspring 2025
Background: Non-CS undergrad, but work professionally in math/computational science, 3rd course after GIOS and RAIT. I was a beginner-intermediate C++ programmer before so this course doubled as both a large-scale programming course + compiler course. I did not meet the recommended pre-reqs e.g., AOS, computer architecture etc. but I was very motivated. I would say this was 1.5x to 2x the effort of GIOS and 3x the effort of RAIT.
I did not have a partner. I expect to get a solid A.
4 homeworks (Scanner, Parser, IR, CodeGen/Optimization): 4 questions each of which tested a compiler workflow or concept. Each HW took 2-3 days to complete.
4 projects (Scanner/Parser, SymbolTable/Semantic Analysis, IR Gen, CodeGen):
The 1st project was trivial. The 2nd and 4th were incredibly challenging. The 2nd because I had to level-up my programming ability and I needed to understand how the Antlr4 visitor interface worked, and the 4th because it was a huge amount of work with a lot of requirements and edge cases. I also was burnout by this stage.
Tip on project 4: Fully understand the MIPS function calling conventions and work out on paper what the function stack will look like before implementing it. Figure out a clear way to map a variable to its register or to its stack position. Also it pays to have a good IR data structure from Project 3, starting from fresh IR for project 4 would have been a lot more work.
The grade on gradescope was effectively the final grade, there were no hidden tests.
I ended up taking 2 full weeks from my day job to write the compiler and I effectively spent most weekends on the course. I ended up with around ~4000 lines of fairly compact code.
Final exam: A large fraction (~80%) of the final exam was quite mechanical: there are about 8 "workflows" you need to memorize from the home works and apply to problems under time pressure. 20% involved tricky questions that tested precise understanding of compiler techniques (e.g., when does this particular optimization apply, when does it not apply etc.).
I prepared using lecture notes and homeworks and skimming through the textbook, except for the chapter on optimization where I read through the textbook in detail.
Tip: Skim through the end of section questions in the textbook to prep for the final.
Takeaways:
- The homeworks and projects were a brutal amount of work.
- I massively leveled up my problem solving, coding and code-design ability because of the projects. This course was single-handedly more useful in making me a better coder than every other project I've done in my life combined.
- Even though we are effectively hacking together a compiler in a few days, it pays to write well-thought out code and to automate as much as possible (e.g., I wrote a bash script to automate submission of the answers, to run a single test case in the debugger, to perform local testing etc.)
- I learnt a lot about compilers. Before this, compilers felt like mysterious transformations that magically worked. Now I realize that it is just a lot of hard work that goes into every step.
- The projects are cumulative: E.g., It is necessary to get a fully working submission for Project 2 for Project 3 and so on.
Rating: 5 / 5Difficulty: 5 / 5Workload: 28 hours / week