diff options
| author | bd-912 <bdunahu@colostate.edu> | 2024-04-07 13:25:40 -0600 | 
|---|---|---|
| committer | bd-912 <bdunahu@colostate.edu> | 2024-04-07 13:25:40 -0600 | 
| commit | c3d4ff012c568a50e3403caf040de704bc201101 (patch) | |
| tree | def9f8871f740e10ff3eb91315fc7184595d1b55 /vaporize | |
| parent | 1ec847c7222b8adb9a70264c98a44dc9911d65d3 (diff) | |
Update vaporize visitor for new ST, observe hard work pay off
Diffstat (limited to 'vaporize')
| -rw-r--r-- | vaporize/library/VaporizeSimp.java | 712 | 
1 files changed, 334 insertions, 378 deletions
diff --git a/vaporize/library/VaporizeSimp.java b/vaporize/library/VaporizeSimp.java index 80db36b..fa026c0 100644 --- a/vaporize/library/VaporizeSimp.java +++ b/vaporize/library/VaporizeSimp.java @@ -2,18 +2,57 @@ package vaporize.library;  import syntaxtree.*;  import visitor.*; +import st.*; +import misc.*;  import java.util.*; -public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> { +public class VaporizeSimp extends GJDepthFirst<String,SymbolTable> { -    private int offset; - -    private void printNode(Node n, A argu) { -        for (int i=0; i < this.offset; ++i) -            Utilities.print_filter(".", false); -        Utilities.print_filter(n.getClass().getSimpleName(), true); -        ++this.offset; -    } +    // +    // Auto class visitors--probably don't need to be overridden. +    // +    public String visit(NodeList n, SymbolTable symt) { +        String mod = ""; +        int _count=0; +        for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) { +            mod += e.nextElement().accept(this,symt); +            _count++; +        } +        return mod; +    } + +    public String visit(NodeListOptional n, SymbolTable symt) { +        String mod = ""; +        if ( n.present() ) { +            int _count=0; +            for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) { +                mod += e.nextElement().accept(this,symt); +                _count++; +            } +            return mod; +        } +        else +            return ""; +    } + +    public String visit(NodeOptional n, SymbolTable symt) { +        if ( n.present() ) +            return n.node.accept(this,symt); +        else +            return ""; +    } + +    public String visit(NodeSequence n, SymbolTable symt) { +        String mod = ""; +        int _count=0; +        for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) { +            mod += e.nextElement().accept(this,symt); +            _count++; +        } +        return mod; +    } + +    public String visit(NodeToken n, SymbolTable symt) { return ""; }      //      // User-generated visitor methods below @@ -24,14 +63,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> ( TypeDeclaration() )*       * f2 -> <EOF>       */ -    public R visit(Goal n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(Goal n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -54,41 +91,41 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f16 -> "}"       * f17 -> "}"       */ -    public R visit(MainClass n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(MainClass n, SymbolTable symt) { +        String mod = ""; +        mod += "func Main()\n"; + +        mod += n.f0.accept(this, symt); +        n.f1.accept(this, symt); // throw class name away +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        mod += n.f5.accept(this, symt); +        mod += n.f6.accept(this, symt); +        mod += n.f7.accept(this, symt); +        mod += n.f8.accept(this, symt); +        mod += n.f9.accept(this, symt); +        mod += n.f10.accept(this, symt); +        n.f11.accept(this, symt); // throw boiler 'args' variable away +        mod += n.f12.accept(this, symt); +        mod += n.f13.accept(this, symt); +        n.f14.accept(this, symt); // FIXME +        mod += n.f15.accept(this, symt); +        mod += n.f16.accept(this, symt); +        mod += n.f17.accept(this, symt); + +        mod += "  ret\n\n"; +        return mod;      }      /**       * f0 -> ClassDeclaration()       *       | ClassExtendsDeclaration()       */ -    public R visit(TypeDeclaration n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(TypeDeclaration n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /** @@ -99,17 +136,21 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f4 -> ( MethodDeclaration() )*       * f5 -> "}"       */ -    public R visit(ClassDeclaration n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(ClassDeclaration n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        String id= n.f1.accept(this, symt); +        mod += "const functable_" + id + "\n"; +        for (MethodInstance mtd : symt.getClass(id).getMethods()) { +            mod += "   :" + id + "_" + mtd + "\n"; +        } +        mod += "\n"; +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        mod += n.f5.accept(this, symt); + +        return mod;      }      /** @@ -122,19 +163,17 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f6 -> ( MethodDeclaration() )*       * f7 -> "}"       */ -    public R visit(ClassExtendsDeclaration n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(ClassExtendsDeclaration n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        mod += n.f5.accept(this, symt); +        mod += n.f6.accept(this, symt); +        mod += n.f7.accept(this, symt); +        return mod;      }      /** @@ -142,14 +181,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> Identifier()       * f2 -> ";"       */ -    public R visit(VarDeclaration n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(VarDeclaration n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -167,63 +204,56 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f11 -> ";"       * f12 -> "}"       */ -    public R visit(MethodDeclaration n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(MethodDeclaration n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        String id = n.f2.accept(this, symt); +        mod += "func " + id; //FIXME After ST properly handles scoping +	mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        mod += n.f5.accept(this, symt); +        mod += n.f6.accept(this, symt); +        mod += n.f7.accept(this, symt); +        mod += n.f8.accept(this, symt); +        mod += n.f9.accept(this, symt); +        mod += n.f10.accept(this, symt); +        mod += n.f11.accept(this, symt); +        mod += n.f12.accept(this, symt); +        return mod;      }      /**       * f0 -> FormalParameter()       * f1 -> ( FormalParameterRest() )*       */ -    public R visit(FormalParameterList n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(FormalParameterList n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        return mod;      }      /**       * f0 -> Type()       * f1 -> Identifier()       */ -    public R visit(FormalParameter n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(FormalParameter n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        return mod;      }      /**       * f0 -> ","       * f1 -> FormalParameter()       */ -    public R visit(FormalParameterRest n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(FormalParameterRest n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        return mod;      }      /** @@ -232,12 +262,10 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       *       | IntegerType()       *       | Identifier()       */ -    public R visit(Type n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(Type n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /** @@ -245,36 +273,30 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> "["       * f2 -> "]"       */ -    public R visit(ArrayType n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(ArrayType n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /**       * f0 -> "boolean"       */ -    public R visit(BooleanType n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(BooleanType n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /**       * f0 -> "int"       */ -    public R visit(IntegerType n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(IntegerType n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /** @@ -285,12 +307,10 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       *       | WhileStatement()       *       | PrintStatement()       */ -    public R visit(Statement n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(Statement n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /** @@ -298,14 +318,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> ( Statement() )*       * f2 -> "}"       */ -    public R visit(Block n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(Block n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -314,15 +332,13 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f2 -> Expression()       * f3 -> ";"       */ -    public R visit(AssignmentStatement n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        n.f3.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(AssignmentStatement n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        return mod;      }      /** @@ -334,18 +350,16 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f5 -> Expression()       * f6 -> ";"       */ -    public R visit(ArrayAssignmentStatement n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(ArrayAssignmentStatement n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        mod += n.f5.accept(this, symt); +        mod += n.f6.accept(this, symt); +        return mod;      }      /** @@ -357,18 +371,16 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f5 -> "else"       * f6 -> Statement()       */ -    public R visit(IfStatement n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(IfStatement n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        mod += n.f5.accept(this, symt); +        mod += n.f6.accept(this, symt); +        return mod;      }      /** @@ -378,16 +390,14 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f3 -> ")"       * f4 -> Statement()       */ -    public R visit(WhileStatement n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(WhileStatement n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        return mod;      }      /** @@ -397,16 +407,14 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f3 -> ")"       * f4 -> ";"       */ -    public R visit(PrintStatement n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(PrintStatement n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        return mod;      }      /** @@ -420,12 +428,10 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       *       | MessageSend()       *       | PrimaryExpression()       */ -    public R visit(Expression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(Expression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /** @@ -433,14 +439,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> "&&"       * f2 -> PrimaryExpression()       */ -    public R visit(AndExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(AndExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -448,14 +452,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> "<"       * f2 -> PrimaryExpression()       */ -    public R visit(CompareExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(CompareExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -463,14 +465,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> "+"       * f2 -> PrimaryExpression()       */ -    public R visit(PlusExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(PlusExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -478,14 +478,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> "-"       * f2 -> PrimaryExpression()       */ -    public R visit(MinusExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(MinusExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -493,14 +491,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> "*"       * f2 -> PrimaryExpression()       */ -    public R visit(TimesExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(TimesExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -509,15 +505,13 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f2 -> PrimaryExpression()       * f3 -> "]"       */ -    public R visit(ArrayLookup n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        n.f3.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(ArrayLookup n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        return mod;      }      /** @@ -525,14 +519,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> "."       * f2 -> "length"       */ -    public R visit(ArrayLength n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(ArrayLength n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }      /** @@ -543,43 +535,37 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f4 -> ( ExpressionList() )?       * f5 -> ")"       */ -    public R visit(MessageSend n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(MessageSend n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        mod += n.f5.accept(this, symt); +        return mod;      }      /**       * f0 -> Expression()       * f1 -> ( ExpressionRest() )*       */ -    public R visit(ExpressionList n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(ExpressionList n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        return mod;      }      /**       * f0 -> ","       * f1 -> Expression()       */ -    public R visit(ExpressionRest n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(ExpressionRest n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        return mod;      }      /** @@ -593,67 +579,55 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       *       | NotExpression()       *       | BracketExpression()       */ -    public R visit(PrimaryExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(PrimaryExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /**       * f0 -> <INTEGER_LITERAL>       */ -    public R visit(IntegerLiteral n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(IntegerLiteral n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /**       * f0 -> "true"       */ -    public R visit(TrueLiteral n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(TrueLiteral n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /**       * f0 -> "false"       */ -    public R visit(FalseLiteral n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(FalseLiteral n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /**       * f0 -> <IDENTIFIER>       */ -    public R visit(Identifier n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(Identifier n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.tokenImage; +        return mod;      }      /**       * f0 -> "this"       */ -    public R visit(ThisExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(ThisExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        return mod;      }      /** @@ -663,16 +637,14 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f3 -> Expression()       * f4 -> "]"       */ -    public R visit(ArrayAllocationExpression n, A argu) { -        this.printNode(n, 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); -        --this.offset; -        return _ret; +    public String visit(ArrayAllocationExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        mod += n.f4.accept(this, symt); +        return mod;      }      /** @@ -681,28 +653,24 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f2 -> "("       * f3 -> ")"       */ -    public R visit(AllocationExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        n.f3.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(AllocationExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        mod += n.f3.accept(this, symt); +        return mod;      }      /**       * f0 -> "!"       * f1 -> Expression()       */ -    public R visit(NotExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        --this.offset; -        return _ret; +    public String visit(NotExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        return mod;      }      /** @@ -710,24 +678,12 @@ public class VaporizeSimp<R,A> extends GJDepthFirst<R,A> {       * f1 -> Expression()       * f2 -> ")"       */ -    public R visit(BracketExpression n, A argu) { -        this.printNode(n, argu); -        R _ret=null; -        n.f0.accept(this, argu); -        n.f1.accept(this, argu); -        n.f2.accept(this, argu); -        --this.offset; -        return _ret; -    } - -    public R visit(NodeToken n, A argu) { -        for (int i=0; i < this.offset; ++i) -            Utilities.print_filter(".", false); -        Utilities.print_filter(n.getClass().getSimpleName() + -                               " => " + -                               n.toString(), true); -        R _ret=null; -        return _ret; +    public String visit(BracketExpression n, SymbolTable symt) { +        String mod = ""; +        mod += n.f0.accept(this, symt); +        mod += n.f1.accept(this, symt); +        mod += n.f2.accept(this, symt); +        return mod;      }  }  | 
