AI Summary
[DOCUMENT_TYPE: user_assignment]
**What This Document Is**
This is a programming assignment for CS 781, Compiler Design and Construction II, at Wright State University. Specifically, Assignment 5 focuses on the crucial phase of compiler development: code generation. It builds directly upon previous assignments involving abstract syntax tree (AST) construction and static analysis, representing a significant milestone in building a fully functional Cool compiler. The assignment centers around translating the intermediate representation of a Cool program into MIPS assembly code.
**Why This Document Matters**
This assignment is essential for students enrolled in advanced compiler design courses. Successfully completing it demonstrates a deep understanding of how high-level programming languages are transformed into executable machine code. It’s particularly valuable for those pursuing careers in software development, compiler technology, or systems programming. Students will benefit from working through this assignment as they prepare for more advanced topics in optimization and runtime systems. It’s best utilized *during* the code generation phase of a compiler design course, after a solid foundation in front-end compilation has been established.
**Common Limitations or Challenges**
This assignment does *not* provide a complete, ready-to-run compiler. It requires substantial implementation effort from the student. It also specifically excludes the need to generate code for the `CASE` expression, narrowing the scope but still demanding a robust solution. The assignment assumes prior knowledge of Cool language syntax, AST structures, and MIPS assembly language. It also doesn’t offer detailed debugging assistance or step-by-step solutions; students are expected to independently troubleshoot and resolve issues.
**What This Document Provides**
* A detailed assignment description outlining the goals and expectations.
* A list of files and directories provided as a starting point, including source code for `cgen.cc`, `cgen.h`, and supporting files.
* Guidance on modifying existing code and adding new functionality to the code generator.
* Instructions for creating and testing a Cool program to validate the generated MIPS assembly code.
* Requirements for a comprehensive README file detailing design decisions, code structure, and justification for the chosen approach.
* Information regarding the grading criteria and files that will be evaluated.