CS 453 Programming Assignment #3 — MeggyJava for Pictures

Due Thursday March 8 (by 11:59pm)

Introduction

This assignment is to be done with your CS 453 programming partner. In this assignment you will be writing a program that parses the PA3 subset of the MeggyJava language that enables any number of pixels to be set with Meggy.setPixel() and can include constant expressions using addition, subtract, multiplication, negation (unary minus), and byte casts as parameters to the Meggy.setPixel() function calls. You will

The Assignment

You should create a jar file, MJPA3.jar, that can be executed as follows:
   java -jar MJPA3_groupname.jar InputFile.java
   

The input files can be any PA3 MeggyJava program. The PA3Picture.java example you wrote for PA1 is a possible test case for MJPA3_groupname.jar. The output file named InputFile.java.s should be an AVR assembly program that using the provided build process will run on the MeggyJr device. Additionally, the InputFile.java.s file must be such that we can run it through the AVR simulator. See the Meggy Sim instructions for usage notes.

Assembly (.s) programs have a prolog and epilog. Files for these are provided in avrH.rtl.s and avrF.rtl.s.

The set of instructions you will need include those in the avrH.rtl.s and avrF.rtl.s files and the following:

        # Examples of each statement type are provided.
        # Register numbers, constant values, and labels can change.
        ldi    r24,lo8(1)
        ldi    r24,73
        push   r24
        pop    r24
        call   functionName

Execute MJSIM.jar for a list of available instructions. For more details about the instructions see the 08-MeggyJrSimple-n-AVR.txt notes.

Notice that avrF.rtl.s already has an infinite loop at the end of main so that the program will always remain running on the Meggy Jr device even if there is no while loop in the MeggyJava program.

For this assignment, no error handling is necessary. In other words, you can assume the input is correct.

Getting Started

Download and untar PA3Empty.tar. Study the file structure. The java_cup subdirectory is needed for the way we are building the MJPA3.jar file in the Makefile. The Makefile will build your parser and create a .jar file.

Submitting the Assignment

Late Policy

Late assignments will be accepted up to 48 hours past the due date for a 10% deduction. The assignment will not be accepted past this period. Late means anything after 11:59pm on the day the assignment is due, including 12 midnight.