CS 453 Programming Assignment #3 — MeggyJava for Buttons

Due Thursday March 5 (by 11:59pm)

Introduction

This assignment can be done with your CS 453 programming partner.

In this assignment you will be writing a program that parses, type checkes, and generates code for the PA3 subset of the MeggyJava language that includes the detection of button presses (Meggy.checkButton), the use of the delay function (Meggy.delay), the function for reading the screen pixel values (Meggy.getPixel), the while statement, the if statement, byte casts, plus, minus, and times, and boolean expressions. Notice the dangling else syntax, and the unary minus syntax.

Java, and therefore MeggyJava allows int, byte mixed type expressions for addition, subtraction, comparison, and negation. This is relevant for type checking as well as code generation.

You will

Example ASTs of some test cases are here:

The Assignment

Download and untar PA3Start.tar.gz from ~cs453/public/. Study the file structure. Copy the provided starter code into a copy of your PA2/ project. All of the AST nodes and visitor pattern are provided. Additionally, there are some example AST visitors in ast_visitors/. See CheckTypes.java for the start of the type checking visitor.

Most importantly there is a regression testing directory called TestCasesMeggy/. This includes the regression testing script for your generated MJ.jar. See the README in that directory for more information.

The input files for your compiler can be any PA3 MeggyJava program. The PA3 test cases you wrote for PA1 are possible test cases for MJ.jar you will create. Plan on writing more test cases as well. Additionally, the InputFile.java.s file must be such that we can run it through the MJSIM simulator. See the Meggy Sim instructions for usage notes. You will also be able to assemble and link the program with the run time library and run it on the Meggy Jr device by using the provided build process.

For more details about the AVR instructions see the 06-AVR.txt notes.

For this assignment, type checking will be performed with a visitor. Your goal is to match the type error messages that are printed by the provided MJ.jar reference compiler made available in ~cs453/public/ or by matching javac. The grading will ensure that your type error messages occur when javac error messages occur. The error messages do not have to be an exact match.

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.