java -jar MJPA4_groupname.jar InputFile.java
The input files can be any PA4 MeggyJava program. The PA4Cylon.java example you wrote for PA2 and PA4buttondot.java are possible test cases for MJPA4_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 MJSIM.jar (NOTE: this is a new version of MJSIM.jar. We will probably have a new version for each programming assignment). See the Meggy Sim instructions for usage notes. The set of instructions you will need include a file declaration at the top of the assembly file (.file "main.java" ), instructions provided 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 r25,hi8(0)
ldi r24,73
lds r24, Button_A
push r24
pop r24
call functionName
tst r24
cp r24, r25
breq MJ_L6
brne MJ_L7
jmp MJ_L6
LabelWithAnyName:
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.
This assignment requires the following implementation strategies be used:
For this assignment, type checking will be performed with a visitor. You will probably want a separate visitor using the ReverseDepthFirstVisitor to associate nodes in the AST to line and position numbers. This information will need to be stored in some data structure that is passed to later visitors. Your goal is to match the type error messages that are printed by the provided MJ_PA3.jar parser and type checker.
Download and untar the ast.tar tarball, which is in ~cs453/public/. Place the ast/ subdirectory within your src/ subdirectory. The ast/ subdirectory should include the node/ and visitor/ subdirectories with all of the ast node subclasses and the visitor framework for programming assignments PA4 through PA7.
Modify your PA3 .cup file so that instead of performing expression evaluation and code generation it generates an AST. See the 3/1/2011 notes about how to generate AST nodes, how to store the AST from the parse, and how to apply the dot visitor to the AST so as to visualize the AST.
Create a concrete visitor (we recommend in a subdirectory under src/ called ast_visitors/) for code generation and byte and integer expression evaluation. Port all of the logic from your PA3 syntax-directed versions of this functionality into the visitor and then make sure that all of your PA3 regression tests still work.
Start adding PA4 features one feature at a time to your lexer, parser, and code generation visitor.
We will cover type checking after break, so the type checking visitor should probably be saved for last.
svn log
svn info
svnlook tree REPOSITORY_PATH
Note that svnlook must be issued on the machine where the repository resides.
~cs453/bin/checkin PA4 MJPA4_groupname.jar
// We will also run the test cases with different arg_opts files.
java -jar MJPA4_groupname.jar TestCase.java
java -jar MJSIM.jar TestCase.java.s > t1
javac TestCase.java
java TestCase > t2
diff t1 t2
// For test cases with type errors.
java -jar MJPA4_groupname.jar TestCase.java > t1
java -jar MJ_PA4.jar TestCase.java > t2
diff t1 t2
// to get the README, subversion.txt, look at source files,
// and view any other required files
jar xf MJPA4_groupname.jar