CS 453 Programming Assignment #5 — Adding tones, less than, classes, methods

Due Thursday April 12th (by 11:59pm MDT :)

Introduction

This assignment is to be done with your CS 453 programming partner. In this assignment you will extend Meggy Java and hence the compiler to the PA5 subset that includes the playing tones method (Meggy.toneStart), the less than operator, user-defined methods, and method calls. You will Note that even though the grammar enables the declaration of classes, you will not be implementing objects until PA6. You need the syntax of class definitions and calling methods on receivers like "new Foo()" and "this". For this assignment, the focus is on code generation for methods. Your compiler needs to check for undefined, double defined, and incorrectly typed symbols.

Meggy Java does not allow passing buttons as parameters to user-defined functions or assigning button values to variables.

Here are some example programs: PA5noDef.java, PA5doubleDef.java, PA5twoCls.java, its symbol table, and its PA5twoCls.java.s file. Notice that PA5doubleDef is legal Java but illegal Meggy Java (no overloading).

The Assignment

We provide code (no longer available) that you can use to get started. You will have to incorporate your lexer, parser, type checker, and code-generator from PA4 into this code. The provided Makefile will create a .jar file, MJ.jar, that can be executed as follows:
   java -jar MJ.jar InputFile.java
   

The input files can be any PA5 MeggyJava program. The PA5Cylon.java example you wrote for PA1 and PA5MazeSolver.java are possible test cases for MJPA5_groupname.jar. Write legal and illegal test cases, and report in README which cases are illegal and why they are illegal. See the Meggy Sim instructions for usage notes.

Getting Started

The following is a suggested progression for starting this assignment:
  1. Start with your working PA4 compiler.
  2. Extend the grammar for the new features in PA5.
  3. Write some functions and function calls in AVR by hand. The AVR code you write should be something you could generate with the AVR code generator visitor. Make sure the assembly code you are using works for recursive functions.
  4. Use additional features in your test inputs such as using parameters in complex expressions and Meggy.toneStart(). Modify the code generator visitor to handle these new features.

Submitting the Assignment

Usual 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.