summaryrefslogtreecommitdiff
path: root/visitor
diff options
context:
space:
mode:
Diffstat (limited to 'visitor')
-rw-r--r--visitor/DepthFirstVisitor.java577
-rw-r--r--visitor/GJDepthFirst.java681
-rw-r--r--visitor/GJNoArguDepthFirst.java681
-rw-r--r--visitor/GJNoArguVisitor.java372
-rw-r--r--visitor/GJVisitor.java371
-rw-r--r--visitor/GJVoidDepthFirst.java587
-rw-r--r--visitor/GJVoidVisitor.java372
-rw-r--r--visitor/Visitor.java372
8 files changed, 4013 insertions, 0 deletions
diff --git a/visitor/DepthFirstVisitor.java b/visitor/DepthFirstVisitor.java
new file mode 100644
index 0000000..a0a5749
--- /dev/null
+++ b/visitor/DepthFirstVisitor.java
@@ -0,0 +1,577 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package visitor;
+import syntaxtree.*;
+import java.util.*;
+
+/**
+ * Provides default methods which visit each node in the tree in depth-first
+ * order. Your visitors may extend this class.
+ */
+public class DepthFirstVisitor implements Visitor {
+ //
+ // Auto class visitors--probably don't need to be overridden.
+ //
+ public void visit(NodeList n) {
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); )
+ e.nextElement().accept(this);
+ }
+
+ public void visit(NodeListOptional n) {
+ if ( n.present() )
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); )
+ e.nextElement().accept(this);
+ }
+
+ public void visit(NodeOptional n) {
+ if ( n.present() )
+ n.node.accept(this);
+ }
+
+ public void visit(NodeSequence n) {
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); )
+ e.nextElement().accept(this);
+ }
+
+ public void visit(NodeToken n) { }
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public void visit(Goal n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> "public"
+ * f4 -> "static"
+ * f5 -> "void"
+ * f6 -> "main"
+ * f7 -> "("
+ * f8 -> "String"
+ * f9 -> "["
+ * f10 -> "]"
+ * f11 -> Identifier()
+ * f12 -> ")"
+ * f13 -> "{"
+ * f14 -> ( VarDeclaration() )*
+ * f15 -> ( Statement() )*
+ * f16 -> "}"
+ * f17 -> "}"
+ */
+ public void visit(MainClass n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ n.f7.accept(this);
+ n.f8.accept(this);
+ n.f9.accept(this);
+ n.f10.accept(this);
+ n.f11.accept(this);
+ n.f12.accept(this);
+ n.f13.accept(this);
+ n.f14.accept(this);
+ n.f15.accept(this);
+ n.f16.accept(this);
+ n.f17.accept(this);
+ }
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public void visit(TypeDeclaration n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public void visit(ClassDeclaration n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public void visit(ClassExtendsDeclaration n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ n.f7.accept(this);
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public void visit(VarDeclaration n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public void visit(MethodDeclaration n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ n.f7.accept(this);
+ n.f8.accept(this);
+ n.f9.accept(this);
+ n.f10.accept(this);
+ n.f11.accept(this);
+ n.f12.accept(this);
+ }
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public void visit(FormalParameterList n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public void visit(FormalParameter n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public void visit(FormalParameterRest n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ }
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public void visit(Type n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public void visit(ArrayType n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> "boolean"
+ */
+ public void visit(BooleanType n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> "int"
+ */
+ public void visit(IntegerType n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public void visit(Statement n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public void visit(Block n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public void visit(AssignmentStatement n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public void visit(ArrayAssignmentStatement n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ }
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public void visit(IfStatement n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ }
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public void visit(WhileStatement n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ }
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public void visit(PrintStatement n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ }
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public void visit(Expression n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(AndExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(CompareExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(PlusExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(MinusExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(TimesExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public void visit(ArrayLookup n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public void visit(ArrayLength n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public void visit(MessageSend n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ }
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public void visit(ExpressionList n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public void visit(ExpressionRest n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ }
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public void visit(PrimaryExpression n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public void visit(IntegerLiteral n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> "true"
+ */
+ public void visit(TrueLiteral n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> "false"
+ */
+ public void visit(FalseLiteral n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public void visit(Identifier n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> "this"
+ */
+ public void visit(ThisExpression n) {
+ n.f0.accept(this);
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public void visit(ArrayAllocationExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public void visit(AllocationExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ }
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public void visit(NotExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ }
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public void visit(BracketExpression n) {
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ }
+
+}
diff --git a/visitor/GJDepthFirst.java b/visitor/GJDepthFirst.java
new file mode 100644
index 0000000..c555d29
--- /dev/null
+++ b/visitor/GJDepthFirst.java
@@ -0,0 +1,681 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package visitor;
+import syntaxtree.*;
+import java.util.*;
+// extend
+/**
+ * Provides default methods which visit each node in the tree in depth-first
+ * order. Your visitors may extend this class.
+ */
+public class GJDepthFirst<R,A> implements GJVisitor<R,A> {
+ //
+ // Auto class visitors--probably don't need to be overridden.
+ //
+ public R visit(NodeList n, A argu) {
+ R _ret=null;
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this,argu);
+ _count++;
+ }
+ return _ret;
+ }
+
+ public R visit(NodeListOptional n, A argu) {
+ if ( n.present() ) {
+ R _ret=null;
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this,argu);
+ _count++;
+ }
+ return _ret;
+ }
+ else
+ return null;
+ }
+
+ public R visit(NodeOptional n, A argu) {
+ if ( n.present() )
+ return n.node.accept(this,argu);
+ else
+ return null;
+ }
+
+ public R visit(NodeSequence n, A argu) {
+ R _ret=null;
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this,argu);
+ _count++;
+ }
+ return _ret;
+ }
+
+ public R visit(NodeToken n, A argu) { return null; }
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public R visit(Goal n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> "public"
+ * f4 -> "static"
+ * f5 -> "void"
+ * f6 -> "main"
+ * f7 -> "("
+ * f8 -> "String"
+ * f9 -> "["
+ * f10 -> "]"
+ * f11 -> Identifier()
+ * f12 -> ")"
+ * f13 -> "{"
+ * f14 -> ( VarDeclaration() )*
+ * f15 -> ( Statement() )*
+ * f16 -> "}"
+ * f17 -> "}"
+ */
+ public R visit(MainClass n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ n.f7.accept(this, argu);
+ n.f8.accept(this, argu);
+ n.f9.accept(this, argu);
+ n.f10.accept(this, argu);
+ n.f11.accept(this, argu);
+ n.f12.accept(this, argu);
+ n.f13.accept(this, argu);
+ n.f14.accept(this, argu);
+ n.f15.accept(this, argu);
+ n.f16.accept(this, argu);
+ n.f17.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public R visit(TypeDeclaration n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public R visit(ClassDeclaration n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public R visit(ClassExtendsDeclaration n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ n.f7.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public R visit(VarDeclaration n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public R visit(MethodDeclaration n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ n.f7.accept(this, argu);
+ n.f8.accept(this, argu);
+ n.f9.accept(this, argu);
+ n.f10.accept(this, argu);
+ n.f11.accept(this, argu);
+ n.f12.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public R visit(FormalParameterList n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public R visit(FormalParameter n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public R visit(FormalParameterRest n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public R visit(Type n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public R visit(ArrayType n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "boolean"
+ */
+ public R visit(BooleanType n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "int"
+ */
+ public R visit(IntegerType n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public R visit(Statement n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public R visit(Block n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public R visit(AssignmentStatement n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public R visit(ArrayAssignmentStatement n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public R visit(IfStatement n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public R visit(WhileStatement n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public R visit(PrintStatement n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public R visit(Expression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(AndExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(CompareExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(PlusExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(MinusExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(TimesExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public R visit(ArrayLookup n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public R visit(ArrayLength n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public R visit(MessageSend n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public R visit(ExpressionList n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public R visit(ExpressionRest n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public R visit(PrimaryExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public R visit(IntegerLiteral n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "true"
+ */
+ public R visit(TrueLiteral n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "false"
+ */
+ public R visit(FalseLiteral n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public R visit(Identifier n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "this"
+ */
+ public R visit(ThisExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public R visit(ArrayAllocationExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public R visit(AllocationExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public R visit(NotExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public R visit(BracketExpression n, A argu) {
+ R _ret=null;
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+}
diff --git a/visitor/GJNoArguDepthFirst.java b/visitor/GJNoArguDepthFirst.java
new file mode 100644
index 0000000..cd8214c
--- /dev/null
+++ b/visitor/GJNoArguDepthFirst.java
@@ -0,0 +1,681 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package visitor;
+import syntaxtree.*;
+import java.util.*;
+
+/**
+ * Provides default methods which visit each node in the tree in depth-first
+ * order. Your visitors may extend this class.
+ */
+public class GJNoArguDepthFirst<R> implements GJNoArguVisitor<R> {
+ //
+ // Auto class visitors--probably don't need to be overridden.
+ //
+ public R visit(NodeList n) {
+ R _ret=null;
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this);
+ _count++;
+ }
+ return _ret;
+ }
+
+ public R visit(NodeListOptional n) {
+ if ( n.present() ) {
+ R _ret=null;
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this);
+ _count++;
+ }
+ return _ret;
+ }
+ else
+ return null;
+ }
+
+ public R visit(NodeOptional n) {
+ if ( n.present() )
+ return n.node.accept(this);
+ else
+ return null;
+ }
+
+ public R visit(NodeSequence n) {
+ R _ret=null;
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this);
+ _count++;
+ }
+ return _ret;
+ }
+
+ public R visit(NodeToken n) { return null; }
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public R visit(Goal n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> "public"
+ * f4 -> "static"
+ * f5 -> "void"
+ * f6 -> "main"
+ * f7 -> "("
+ * f8 -> "String"
+ * f9 -> "["
+ * f10 -> "]"
+ * f11 -> Identifier()
+ * f12 -> ")"
+ * f13 -> "{"
+ * f14 -> ( VarDeclaration() )*
+ * f15 -> ( Statement() )*
+ * f16 -> "}"
+ * f17 -> "}"
+ */
+ public R visit(MainClass n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ n.f7.accept(this);
+ n.f8.accept(this);
+ n.f9.accept(this);
+ n.f10.accept(this);
+ n.f11.accept(this);
+ n.f12.accept(this);
+ n.f13.accept(this);
+ n.f14.accept(this);
+ n.f15.accept(this);
+ n.f16.accept(this);
+ n.f17.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public R visit(TypeDeclaration n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public R visit(ClassDeclaration n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public R visit(ClassExtendsDeclaration n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ n.f7.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public R visit(VarDeclaration n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public R visit(MethodDeclaration n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ n.f7.accept(this);
+ n.f8.accept(this);
+ n.f9.accept(this);
+ n.f10.accept(this);
+ n.f11.accept(this);
+ n.f12.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public R visit(FormalParameterList n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public R visit(FormalParameter n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public R visit(FormalParameterRest n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public R visit(Type n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public R visit(ArrayType n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "boolean"
+ */
+ public R visit(BooleanType n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "int"
+ */
+ public R visit(IntegerType n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public R visit(Statement n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public R visit(Block n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public R visit(AssignmentStatement n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public R visit(ArrayAssignmentStatement n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public R visit(IfStatement n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ n.f6.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public R visit(WhileStatement n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public R visit(PrintStatement n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public R visit(Expression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(AndExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(CompareExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(PlusExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(MinusExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(TimesExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public R visit(ArrayLookup n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public R visit(ArrayLength n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public R visit(MessageSend n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ n.f5.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public R visit(ExpressionList n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public R visit(ExpressionRest n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public R visit(PrimaryExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public R visit(IntegerLiteral n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "true"
+ */
+ public R visit(TrueLiteral n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "false"
+ */
+ public R visit(FalseLiteral n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public R visit(Identifier n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "this"
+ */
+ public R visit(ThisExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public R visit(ArrayAllocationExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ n.f4.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public R visit(AllocationExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ n.f3.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public R visit(NotExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ return _ret;
+ }
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public R visit(BracketExpression n) {
+ R _ret=null;
+ n.f0.accept(this);
+ n.f1.accept(this);
+ n.f2.accept(this);
+ return _ret;
+ }
+
+}
diff --git a/visitor/GJNoArguVisitor.java b/visitor/GJNoArguVisitor.java
new file mode 100644
index 0000000..6a0f344
--- /dev/null
+++ b/visitor/GJNoArguVisitor.java
@@ -0,0 +1,372 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package visitor;
+import syntaxtree.*;
+import java.util.*;
+
+/**
+ * All GJ visitors with no argument must implement this interface.
+ */
+
+public interface GJNoArguVisitor<R> {
+
+ //
+ // GJ Auto class visitors with no argument
+ //
+
+ public R visit(NodeList n);
+ public R visit(NodeListOptional n);
+ public R visit(NodeOptional n);
+ public R visit(NodeSequence n);
+ public R visit(NodeToken n);
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public R visit(Goal n);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> "public"
+ * f4 -> "static"
+ * f5 -> "void"
+ * f6 -> "main"
+ * f7 -> "("
+ * f8 -> "String"
+ * f9 -> "["
+ * f10 -> "]"
+ * f11 -> Identifier()
+ * f12 -> ")"
+ * f13 -> "{"
+ * f14 -> ( VarDeclaration() )*
+ * f15 -> ( Statement() )*
+ * f16 -> "}"
+ * f17 -> "}"
+ */
+ public R visit(MainClass n);
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public R visit(TypeDeclaration n);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public R visit(ClassDeclaration n);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public R visit(ClassExtendsDeclaration n);
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public R visit(VarDeclaration n);
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public R visit(MethodDeclaration n);
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public R visit(FormalParameterList n);
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public R visit(FormalParameter n);
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public R visit(FormalParameterRest n);
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public R visit(Type n);
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public R visit(ArrayType n);
+
+ /**
+ * f0 -> "boolean"
+ */
+ public R visit(BooleanType n);
+
+ /**
+ * f0 -> "int"
+ */
+ public R visit(IntegerType n);
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public R visit(Statement n);
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public R visit(Block n);
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public R visit(AssignmentStatement n);
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public R visit(ArrayAssignmentStatement n);
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public R visit(IfStatement n);
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public R visit(WhileStatement n);
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public R visit(PrintStatement n);
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public R visit(Expression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(AndExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(CompareExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(PlusExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(MinusExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(TimesExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public R visit(ArrayLookup n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public R visit(ArrayLength n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public R visit(MessageSend n);
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public R visit(ExpressionList n);
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public R visit(ExpressionRest n);
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public R visit(PrimaryExpression n);
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public R visit(IntegerLiteral n);
+
+ /**
+ * f0 -> "true"
+ */
+ public R visit(TrueLiteral n);
+
+ /**
+ * f0 -> "false"
+ */
+ public R visit(FalseLiteral n);
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public R visit(Identifier n);
+
+ /**
+ * f0 -> "this"
+ */
+ public R visit(ThisExpression n);
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public R visit(ArrayAllocationExpression n);
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public R visit(AllocationExpression n);
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public R visit(NotExpression n);
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public R visit(BracketExpression n);
+
+}
+
diff --git a/visitor/GJVisitor.java b/visitor/GJVisitor.java
new file mode 100644
index 0000000..47af1a5
--- /dev/null
+++ b/visitor/GJVisitor.java
@@ -0,0 +1,371 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package visitor;
+import syntaxtree.*;
+import java.util.*;
+
+/**
+ * All GJ visitors must implement this interface.
+ */
+
+public interface GJVisitor<R,A> {
+
+ //
+ // GJ Auto class visitors
+ //
+
+ public R visit(NodeList n, A argu);
+ public R visit(NodeListOptional n, A argu);
+ public R visit(NodeOptional n, A argu);
+ public R visit(NodeSequence n, A argu);
+ public R visit(NodeToken n, A argu);
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public R visit(Goal n, A argu);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> "public"
+ * f4 -> "static"
+ * f5 -> "void"
+ * f6 -> "main"
+ * f7 -> "("
+ * f8 -> "String"
+ * f9 -> "["
+ * f10 -> "]"
+ * f11 -> Identifier()
+ * f12 -> ")"
+ * f13 -> "{"
+ * f14 -> ( VarDeclaration() )*
+ * f15 -> ( Statement() )*
+ * f16 -> "}"
+ * f17 -> "}"
+ */
+ public R visit(MainClass n, A argu);
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public R visit(TypeDeclaration n, A argu);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public R visit(ClassDeclaration n, A argu);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public R visit(ClassExtendsDeclaration n, A argu);
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public R visit(VarDeclaration n, A argu);
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public R visit(MethodDeclaration n, A argu);
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public R visit(FormalParameterList n, A argu);
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public R visit(FormalParameter n, A argu);
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public R visit(FormalParameterRest n, A argu);
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public R visit(Type n, A argu);
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public R visit(ArrayType n, A argu);
+
+ /**
+ * f0 -> "boolean"
+ */
+ public R visit(BooleanType n, A argu);
+
+ /**
+ * f0 -> "int"
+ */
+ public R visit(IntegerType n, A argu);
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public R visit(Statement n, A argu);
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public R visit(Block n, A argu);
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public R visit(AssignmentStatement n, A argu);
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public R visit(ArrayAssignmentStatement n, A argu);
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public R visit(IfStatement n, A argu);
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public R visit(WhileStatement n, A argu);
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public R visit(PrintStatement n, A argu);
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public R visit(Expression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(AndExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(CompareExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(PlusExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(MinusExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public R visit(TimesExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public R visit(ArrayLookup n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public R visit(ArrayLength n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public R visit(MessageSend n, A argu);
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public R visit(ExpressionList n, A argu);
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public R visit(ExpressionRest n, A argu);
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public R visit(PrimaryExpression n, A argu);
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public R visit(IntegerLiteral n, A argu);
+
+ /**
+ * f0 -> "true"
+ */
+ public R visit(TrueLiteral n, A argu);
+
+ /**
+ * f0 -> "false"
+ */
+ public R visit(FalseLiteral n, A argu);
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public R visit(Identifier n, A argu);
+
+ /**
+ * f0 -> "this"
+ */
+ public R visit(ThisExpression n, A argu);
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public R visit(ArrayAllocationExpression n, A argu);
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public R visit(AllocationExpression n, A argu);
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public R visit(NotExpression n, A argu);
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public R visit(BracketExpression n, A argu);
+
+}
diff --git a/visitor/GJVoidDepthFirst.java b/visitor/GJVoidDepthFirst.java
new file mode 100644
index 0000000..4267259
--- /dev/null
+++ b/visitor/GJVoidDepthFirst.java
@@ -0,0 +1,587 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package visitor;
+import syntaxtree.*;
+import java.util.*;
+
+/**
+ * Provides default methods which visit each node in the tree in depth-first
+ * order. Your visitors may extend this class.
+ */
+public class GJVoidDepthFirst<A> implements GJVoidVisitor<A> {
+ //
+ // Auto class visitors--probably don't need to be overridden.
+ //
+ public void visit(NodeList n, A argu) {
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this,argu);
+ _count++;
+ }
+ }
+
+ public void visit(NodeListOptional n, A argu) {
+ if ( n.present() ) {
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this,argu);
+ _count++;
+ }
+ }
+ }
+
+ public void visit(NodeOptional n, A argu) {
+ if ( n.present() )
+ n.node.accept(this,argu);
+ }
+
+ public void visit(NodeSequence n, A argu) {
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this,argu);
+ _count++;
+ }
+ }
+
+ public void visit(NodeToken n, A argu) {}
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public void visit(Goal n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> "public"
+ * f4 -> "static"
+ * f5 -> "void"
+ * f6 -> "main"
+ * f7 -> "("
+ * f8 -> "String"
+ * f9 -> "["
+ * f10 -> "]"
+ * f11 -> Identifier()
+ * f12 -> ")"
+ * f13 -> "{"
+ * f14 -> ( VarDeclaration() )*
+ * f15 -> ( Statement() )*
+ * f16 -> "}"
+ * f17 -> "}"
+ */
+ public void visit(MainClass n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ n.f7.accept(this, argu);
+ n.f8.accept(this, argu);
+ n.f9.accept(this, argu);
+ n.f10.accept(this, argu);
+ n.f11.accept(this, argu);
+ n.f12.accept(this, argu);
+ n.f13.accept(this, argu);
+ n.f14.accept(this, argu);
+ n.f15.accept(this, argu);
+ n.f16.accept(this, argu);
+ n.f17.accept(this, argu);
+ }
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public void visit(TypeDeclaration n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public void visit(ClassDeclaration n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public void visit(ClassExtendsDeclaration n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ n.f7.accept(this, argu);
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public void visit(VarDeclaration n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public void visit(MethodDeclaration n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ n.f7.accept(this, argu);
+ n.f8.accept(this, argu);
+ n.f9.accept(this, argu);
+ n.f10.accept(this, argu);
+ n.f11.accept(this, argu);
+ n.f12.accept(this, argu);
+ }
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public void visit(FormalParameterList n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public void visit(FormalParameter n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public void visit(FormalParameterRest n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ }
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public void visit(Type n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public void visit(ArrayType n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "boolean"
+ */
+ public void visit(BooleanType n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "int"
+ */
+ public void visit(IntegerType n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public void visit(Statement n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public void visit(Block n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public void visit(AssignmentStatement n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public void visit(ArrayAssignmentStatement n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public void visit(IfStatement n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ n.f6.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public void visit(WhileStatement n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public void visit(PrintStatement n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ }
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public void visit(Expression n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(AndExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(CompareExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(PlusExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(MinusExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(TimesExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public void visit(ArrayLookup n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public void visit(ArrayLength n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public void visit(MessageSend n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ n.f5.accept(this, argu);
+ }
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public void visit(ExpressionList n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public void visit(ExpressionRest n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ }
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public void visit(PrimaryExpression n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public void visit(IntegerLiteral n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "true"
+ */
+ public void visit(TrueLiteral n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "false"
+ */
+ public void visit(FalseLiteral n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public void visit(Identifier n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "this"
+ */
+ public void visit(ThisExpression n, A argu) {
+ n.f0.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public void visit(ArrayAllocationExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ n.f4.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public void visit(AllocationExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public void visit(NotExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ }
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public void visit(BracketExpression n, A argu) {
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ }
+
+}
diff --git a/visitor/GJVoidVisitor.java b/visitor/GJVoidVisitor.java
new file mode 100644
index 0000000..3655f02
--- /dev/null
+++ b/visitor/GJVoidVisitor.java
@@ -0,0 +1,372 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package visitor;
+import syntaxtree.*;
+import java.util.*;
+
+/**
+ * All GJ void visitors must implement this interface.
+ */
+
+public interface GJVoidVisitor<A> {
+
+ //
+ // GJ void Auto class visitors
+ //
+
+ public void visit(NodeList n, A argu);
+ public void visit(NodeListOptional n, A argu);
+ public void visit(NodeOptional n, A argu);
+ public void visit(NodeSequence n, A argu);
+ public void visit(NodeToken n, A argu);
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public void visit(Goal n, A argu);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> "public"
+ * f4 -> "static"
+ * f5 -> "void"
+ * f6 -> "main"
+ * f7 -> "("
+ * f8 -> "String"
+ * f9 -> "["
+ * f10 -> "]"
+ * f11 -> Identifier()
+ * f12 -> ")"
+ * f13 -> "{"
+ * f14 -> ( VarDeclaration() )*
+ * f15 -> ( Statement() )*
+ * f16 -> "}"
+ * f17 -> "}"
+ */
+ public void visit(MainClass n, A argu);
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public void visit(TypeDeclaration n, A argu);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public void visit(ClassDeclaration n, A argu);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public void visit(ClassExtendsDeclaration n, A argu);
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public void visit(VarDeclaration n, A argu);
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public void visit(MethodDeclaration n, A argu);
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public void visit(FormalParameterList n, A argu);
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public void visit(FormalParameter n, A argu);
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public void visit(FormalParameterRest n, A argu);
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public void visit(Type n, A argu);
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public void visit(ArrayType n, A argu);
+
+ /**
+ * f0 -> "boolean"
+ */
+ public void visit(BooleanType n, A argu);
+
+ /**
+ * f0 -> "int"
+ */
+ public void visit(IntegerType n, A argu);
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public void visit(Statement n, A argu);
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public void visit(Block n, A argu);
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public void visit(AssignmentStatement n, A argu);
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public void visit(ArrayAssignmentStatement n, A argu);
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public void visit(IfStatement n, A argu);
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public void visit(WhileStatement n, A argu);
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public void visit(PrintStatement n, A argu);
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public void visit(Expression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(AndExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(CompareExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(PlusExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(MinusExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(TimesExpression n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public void visit(ArrayLookup n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public void visit(ArrayLength n, A argu);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public void visit(MessageSend n, A argu);
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public void visit(ExpressionList n, A argu);
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public void visit(ExpressionRest n, A argu);
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public void visit(PrimaryExpression n, A argu);
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public void visit(IntegerLiteral n, A argu);
+
+ /**
+ * f0 -> "true"
+ */
+ public void visit(TrueLiteral n, A argu);
+
+ /**
+ * f0 -> "false"
+ */
+ public void visit(FalseLiteral n, A argu);
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public void visit(Identifier n, A argu);
+
+ /**
+ * f0 -> "this"
+ */
+ public void visit(ThisExpression n, A argu);
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public void visit(ArrayAllocationExpression n, A argu);
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public void visit(AllocationExpression n, A argu);
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public void visit(NotExpression n, A argu);
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public void visit(BracketExpression n, A argu);
+
+}
+
diff --git a/visitor/Visitor.java b/visitor/Visitor.java
new file mode 100644
index 0000000..41804c1
--- /dev/null
+++ b/visitor/Visitor.java
@@ -0,0 +1,372 @@
+//
+// Generated by JTB 1.3.2
+//
+
+package visitor;
+import syntaxtree.*;
+import java.util.*;
+
+/**
+ * All void visitors must implement this interface.
+ */
+
+public interface Visitor {
+
+ //
+ // void Auto class visitors
+ //
+
+ public void visit(NodeList n);
+ public void visit(NodeListOptional n);
+ public void visit(NodeOptional n);
+ public void visit(NodeSequence n);
+ public void visit(NodeToken n);
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public void visit(Goal n);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> "public"
+ * f4 -> "static"
+ * f5 -> "void"
+ * f6 -> "main"
+ * f7 -> "("
+ * f8 -> "String"
+ * f9 -> "["
+ * f10 -> "]"
+ * f11 -> Identifier()
+ * f12 -> ")"
+ * f13 -> "{"
+ * f14 -> ( VarDeclaration() )*
+ * f15 -> ( Statement() )*
+ * f16 -> "}"
+ * f17 -> "}"
+ */
+ public void visit(MainClass n);
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public void visit(TypeDeclaration n);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public void visit(ClassDeclaration n);
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public void visit(ClassExtendsDeclaration n);
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public void visit(VarDeclaration n);
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public void visit(MethodDeclaration n);
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public void visit(FormalParameterList n);
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public void visit(FormalParameter n);
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public void visit(FormalParameterRest n);
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public void visit(Type n);
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public void visit(ArrayType n);
+
+ /**
+ * f0 -> "boolean"
+ */
+ public void visit(BooleanType n);
+
+ /**
+ * f0 -> "int"
+ */
+ public void visit(IntegerType n);
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public void visit(Statement n);
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public void visit(Block n);
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public void visit(AssignmentStatement n);
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public void visit(ArrayAssignmentStatement n);
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public void visit(IfStatement n);
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public void visit(WhileStatement n);
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public void visit(PrintStatement n);
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public void visit(Expression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(AndExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(CompareExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(PlusExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(MinusExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public void visit(TimesExpression n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public void visit(ArrayLookup n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public void visit(ArrayLength n);
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public void visit(MessageSend n);
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public void visit(ExpressionList n);
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public void visit(ExpressionRest n);
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public void visit(PrimaryExpression n);
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public void visit(IntegerLiteral n);
+
+ /**
+ * f0 -> "true"
+ */
+ public void visit(TrueLiteral n);
+
+ /**
+ * f0 -> "false"
+ */
+ public void visit(FalseLiteral n);
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public void visit(Identifier n);
+
+ /**
+ * f0 -> "this"
+ */
+ public void visit(ThisExpression n);
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public void visit(ArrayAllocationExpression n);
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public void visit(AllocationExpression n);
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public void visit(NotExpression n);
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public void visit(BracketExpression n);
+
+}
+