Milestone #3: AST to ILOC¶
Due: Wednesday December 1st at 11:59pm
This milestone will require you to complete the translation from AST to ILOC.
Getting started¶
You will not be creating a new repository for every milestone. Continue to work out of the same repository as Milestone #1 and #2 for all remaining milestones and the final submission of the compiler.
[IMPORTANT- Updated] Language Overview: GoLite¶
To make the handling of memory management easier for you, we will require the programmer free (i.e. delete) any memory they allocated with the new
function. This makes it easier on compiler writers because they will not have to handle memory deallocation via implementing a garage collector in the runtime system. Thus, update the semantic analysis phase of your compiler by adding the following semantics:
All allocated memory must be freed (i.e., deallocated) by the programmer. A programmer can deallocate memory that was allocated with the
new
function by callingdelete(pointer)
. Thedelete
function make take in a pointer to a memory address (i.e., it must take in a struct value). Make sure the argument is of type struct.
Please make sure you read over the document that describes the language we will be implementing this quarter: Language Overview
Milestone Requirement: ILOC¶
For this milestone, your compiler will take the validated AST from semantic analysis translate it into ILOC. As stated in lecture, the output of ILOC is a slice of function fragments that contain ILOC instructions for every function defined.
Command-line Options Augmented¶
For this milestone, the must augment the compiler with the additional command line argument flags:
-iloc
: Produces a print out of the ILOC generated by the compiler after translating the AST to ILOC. The print out should be the printing of ILOC instructions and labels. You are required to do the following:
All labels must be justified all the way to the left. No instruction should begin on the same line as a label.
All instructions should be aligned and justified 4 spaces from the longest label in the program.
Here is an example printout
main:
add r0,r1,#4
sub r2,r0,#5
A_VERY_LONG_LABEL:
add r1,r0,#98
add r2,r1,r3
Grading and What to Submit¶
You must provide the following to get full credit for this milestone:
You can reuse the same Golite files you submitted for milestone #2 for testing purposes.
A
README
file that states how to read the printing of your-iloc
command line options.
The milestone is 5% of your grade and the exact weights for grading are:
5% credit: Generation to ILOC is fully complete with a few minor edge-cases not handled.
3% credit: Generation to ILOC is partially implemented.
0% credit: No solution provided or none of the above requirements have been met.
Submission¶
Before submitting, make sure you’ve added, committed, and pushed all your code to GitHub. You must submit your final work through Gradescope (linked from our Canvas site) in the “Milestone #3” assignment page via two ways,
Uploading from Github directly (recommended way): You can link your Github account to your Gradescope account and upload the correct repository based on the homework assignment. When you submit your homework, a pop window will appear. Click on “Github” and then “Connect to Github” to connect your Github account to Gradescope. Once you connect (you will only need to do this once), then you can select the repository you wish to upload and the branch (which should always be “main” or “master”) for this course.
Uploading via a Zip file: You can also upload a zip file of the assignment directory.