COP5555 HW5 CodeGenVisitor Help:
1. Make sure your HW submission has "cop5555.jar" file in it.
It should includes:
cop5555/Scanner.java,
cop5555/Parser.java,
cop5555/TypeCheckVisitor.java,
cop5555/TypeCheckException.java,
cop5555.ast package,
and cop5555/CodeGenVisitor.java
2. Don't change cop5555.tokens package or given runtime.jar
3. Don't submit your .class files
4. Test Driver will test your program in two steps.
First, run 'java TestCodeGen test_file_name', and then 'java test_file_name'.
Your CodeGenVisitor should generate the test_file_name.class in current directory.
5. You can use the test0 ~ test4 to test your program.
TestProgram is as follows,
import java.io.*;
import cop5555.*;
import cop5555.ast.*;
public class TestCodeGen
{
public static void main(String[] args) throws IOException
{
BufferedReader r;
PrintStream out;
if (args.length == 0)
{
System.out.println("error: missing input file");
System.exit(1);
}
r = new BufferedReader(new FileReader(args[0]));
Parser parser = new Parser(r);
Program tree = null;
try
{
tree = (Program) parser.parse();
ASTVisitor chk = new TypeCheckingVisitor();
tree.visit(chk,null);
ASTVisitor gen = new CodeGenVisitor();
tree.visit(gen,null);
}
catch (Exception e)
{ e.printStackTrace(); }
}
}
Note: Make sure to test your program at eclipse.cise.ufl.edu machine. We will use this machine to test.
Good luck!