summaryrefslogtreecommitdiff
path: root/heat/HeatVisitor.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-26 17:01:49 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-26 17:01:49 -0600
commit7c6c79a437a4c1e7cf85964d005a3cdeb59809f1 (patch)
tree87318f07590b624d4408410e4b2693ad20dff166 /heat/HeatVisitor.java
parentccd38b0746b0b5aeeefdd6e49f2c9d6cb66676f4 (diff)
Added skeleton files in "heat" libary, successor to TypeCheckSimp
Diffstat (limited to 'heat/HeatVisitor.java')
-rw-r--r--heat/HeatVisitor.java998
1 files changed, 998 insertions, 0 deletions
diff --git a/heat/HeatVisitor.java b/heat/HeatVisitor.java
new file mode 100644
index 0000000..746166c
--- /dev/null
+++ b/heat/HeatVisitor.java
@@ -0,0 +1,998 @@
+package heat;
+
+import syntaxtree.*;
+import visitor.*;
+import st.*;
+import misc.*;
+import java.util.*;
+
+public class HeatVisitor extends GJDepthFirst<TypeBundle,String> {
+
+ private SymbolTable symt;
+
+ public HeatVisitor(SymbolTable symt) {
+ this.symt = symt;
+ }
+
+ //
+ // Auto class visitors--probably don't need to be overridden.
+ //
+ public TypeBundle visit(NodeList n, String argu) {
+ TypeBundle _ret=null;
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this,argu);
+ _count++;
+ }
+ return _ret;
+ }
+
+ public TypeBundle visit(NodeListOptional n, String argu) {
+ if ( n.present() ) {
+ TypeBundle _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 TypeBundle visit(NodeOptional n, String argu) {
+ if ( n.present() )
+ return n.node.accept(this,argu);
+ else
+ return null;
+ }
+
+ public TypeBundle visit(NodeSequence n, String argu) {
+ TypeBundle _ret=null;
+ int _count=0;
+ for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
+ e.nextElement().accept(this,argu);
+ _count++;
+ }
+ return _ret;
+ }
+
+ public TypeBundle visit(NodeToken n, String argu) { return null; }
+
+ //
+ // User-generated visitor methods below
+ //
+
+ /**
+ * f0 -> MainClass()
+ * f1 -> ( TypeDeclaration() )*
+ * f2 -> <EOF>
+ */
+ public TypeBundle visit(Goal n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ 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 TypeBundle visit(MainClass n, String argu) {
+ TypeBundle _ret=null;
+ String id = n.f1.f0.tokenImage;
+ MinimalLogger.info(String.format("-> %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ this.symt.setActive(TypeEnum.classname, symt.getClass(id));
+ this.symt.setActive(TypeEnum.method, symt.getMethod(n.f6.tokenImage));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ this.symt.removeActive(TypeEnum.method);
+ this.symt.removeActive(TypeEnum.classname);
+ MinimalLogger.info(String.format("<- %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ return _ret;
+ }
+
+ /**
+ * f0 -> ClassDeclaration()
+ * | ClassExtendsDeclaration()
+ */
+ public TypeBundle visit(TypeDeclaration n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "{"
+ * f3 -> ( VarDeclaration() )*
+ * f4 -> ( MethodDeclaration() )*
+ * f5 -> "}"
+ */
+ public TypeBundle visit(ClassDeclaration n, String argu) {
+ TypeBundle _ret=null;
+ String id = n.f1.f0.tokenImage;
+ MinimalLogger.info(String.format("-> %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ this.symt.setActive(TypeEnum.classname, symt.getClass(id));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ this.symt.removeActive(TypeEnum.classname);
+ MinimalLogger.info(String.format("<- %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "class"
+ * f1 -> Identifier()
+ * f2 -> "extends"
+ * f3 -> Identifier()
+ * f4 -> "{"
+ * f5 -> ( VarDeclaration() )*
+ * f6 -> ( MethodDeclaration() )*
+ * f7 -> "}"
+ */
+ public TypeBundle visit(ClassExtendsDeclaration n, String argu) {
+ TypeBundle _ret=null;
+ String id = n.f1.f0.tokenImage;
+ MinimalLogger.info(String.format("-> %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ this.symt.setActive(TypeEnum.classname, symt.getClass(id));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ this.symt.removeActive(TypeEnum.classname);
+ MinimalLogger.info(String.format("<- %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ return _ret;
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ * f2 -> ";"
+ */
+ public TypeBundle visit(VarDeclaration n, String argu) {
+ TypeBundle _ret=null;
+ String id = n.f1.f0.tokenImage;
+ MinimalLogger.info(String.format("-> %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "public"
+ * f1 -> Type()
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( FormalParameterList() )?
+ * f5 -> ")"
+ * f6 -> "{"
+ * f7 -> ( VarDeclaration() )*
+ * f8 -> ( Statement() )*
+ * f9 -> "return"
+ * f10 -> Expression()
+ * f11 -> ";"
+ * f12 -> "}"
+ */
+ public TypeBundle visit(MethodDeclaration n, String argu) {
+ TypeBundle _ret=null;
+ String id = n.f2.f0.tokenImage;
+ MinimalLogger.info(String.format("-> %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ this.symt.setActive(TypeEnum.method, symt.getMethod(id));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ this.symt.removeActive(TypeEnum.method);
+ MinimalLogger.info(String.format("<- %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ return _ret;
+ }
+
+ /**
+ * f0 -> FormalParameter()
+ * f1 -> ( FormalParameterRest() )*
+ */
+ public TypeBundle visit(FormalParameterList n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> Type()
+ * f1 -> Identifier()
+ */
+ public TypeBundle visit(FormalParameter n, String argu) {
+ TypeBundle _ret=null;
+ String id = n.f1.f0.tokenImage;
+ MinimalLogger.info(String.format("-> %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s (%s)",
+ n.getClass().getSimpleName(),
+ id));
+ ///////////////////////////////////////////////////////////////
+ return _ret;
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> FormalParameter()
+ */
+ public TypeBundle visit(FormalParameterRest n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> ArrayType()
+ * | BooleanType()
+ * | IntegerType()
+ * | Identifier()
+ */
+ public TypeBundle visit(Type n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "int"
+ * f1 -> "["
+ * f2 -> "]"
+ */
+ public TypeBundle visit(ArrayType n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "boolean"
+ */
+ public TypeBundle visit(BooleanType n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "int"
+ */
+ public TypeBundle visit(IntegerType n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> Block()
+ * | AssignmentStatement()
+ * | ArrayAssignmentStatement()
+ * | IfStatement()
+ * | WhileStatement()
+ * | PrintStatement()
+ */
+ public TypeBundle visit(Statement n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "{"
+ * f1 -> ( Statement() )*
+ * f2 -> "}"
+ */
+ public TypeBundle visit(Block n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "="
+ * f2 -> Expression()
+ * f3 -> ";"
+ */
+ public TypeBundle visit(AssignmentStatement n, String argu) {
+ TypeBundle _ret=null;
+ String id = n.f0.f0.tokenImage;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> Identifier()
+ * f1 -> "["
+ * f2 -> Expression()
+ * f3 -> "]"
+ * f4 -> "="
+ * f5 -> Expression()
+ * f6 -> ";"
+ */
+ public TypeBundle visit(ArrayAssignmentStatement n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "if"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ * f5 -> "else"
+ * f6 -> Statement()
+ */
+ public TypeBundle visit(IfStatement n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "while"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> Statement()
+ */
+ public TypeBundle visit(WhileStatement n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "System.out.println"
+ * f1 -> "("
+ * f2 -> Expression()
+ * f3 -> ")"
+ * f4 -> ";"
+ */
+ public TypeBundle visit(PrintStatement n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> AndExpression()
+ * | CompareExpression()
+ * | PlusExpression()
+ * | MinusExpression()
+ * | TimesExpression()
+ * | ArrayLookup()
+ * | ArrayLength()
+ * | MessageSend()
+ * | PrimaryExpression()
+ */
+ public TypeBundle visit(Expression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "&&"
+ * f2 -> PrimaryExpression()
+ */
+ public TypeBundle visit(AndExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "<"
+ * f2 -> PrimaryExpression()
+ */
+ public TypeBundle visit(CompareExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "+"
+ * f2 -> PrimaryExpression()
+ */
+ public TypeBundle visit(PlusExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "-"
+ * f2 -> PrimaryExpression()
+ */
+ public TypeBundle visit(MinusExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "*"
+ * f2 -> PrimaryExpression()
+ */
+ public TypeBundle visit(TimesExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "["
+ * f2 -> PrimaryExpression()
+ * f3 -> "]"
+ */
+ public TypeBundle visit(ArrayLookup n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> "length"
+ */
+ public TypeBundle visit(ArrayLength n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> PrimaryExpression()
+ * f1 -> "."
+ * f2 -> Identifier()
+ * f3 -> "("
+ * f4 -> ( ExpressionList() )?
+ * f5 -> ")"
+ */
+ public TypeBundle visit(MessageSend n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> Expression()
+ * f1 -> ( ExpressionRest() )*
+ */
+ public TypeBundle visit(ExpressionList n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> ","
+ * f1 -> Expression()
+ */
+ public TypeBundle visit(ExpressionRest n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> IntegerLiteral()
+ * | TrueLiteral()
+ * | FalseLiteral()
+ * | Identifier()
+ * | ThisExpression()
+ * | ArrayAllocationExpression()
+ * | AllocationExpression()
+ * | NotExpression()
+ * | BracketExpression()
+ */
+ public TypeBundle visit(PrimaryExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> <INTEGER_LITERAL>
+ */
+ public TypeBundle visit(IntegerLiteral n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "true"
+ */
+ public TypeBundle visit(TrueLiteral n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "false"
+ */
+ public TypeBundle visit(FalseLiteral n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> <IDENTIFIER>
+ */
+ public TypeBundle visit(Identifier n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "this"
+ */
+ public TypeBundle visit(ThisExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> "int"
+ * f2 -> "["
+ * f3 -> Expression()
+ * f4 -> "]"
+ */
+ public TypeBundle visit(ArrayAllocationExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ 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);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "new"
+ * f1 -> Identifier()
+ * f2 -> "("
+ * f3 -> ")"
+ */
+ public TypeBundle visit(AllocationExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ n.f3.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "!"
+ * f1 -> Expression()
+ */
+ public TypeBundle visit(NotExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+ /**
+ * f0 -> "("
+ * f1 -> Expression()
+ * f2 -> ")"
+ */
+ public TypeBundle visit(BracketExpression n, String argu) {
+ TypeBundle _ret=null;
+ MinimalLogger.info(String.format("-> %s",
+ n.getClass().getSimpleName()));
+ ///////////////////////////////////////////////////////////////
+ n.f0.accept(this, argu);
+ n.f1.accept(this, argu);
+ n.f2.accept(this, argu);
+ ///////////////////////////////////////////////////////////////
+ MinimalLogger.info(String.format("<- %s with %s",
+ n.getClass().getSimpleName(),
+ _ret));
+ return _ret;
+ }
+
+}