summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--heat/TypeCheckSimp.java1097
-rw-r--r--output/BinaryTree.java334
-rw-r--r--output/BinaryTree.vapor764
-rw-r--r--output/BinaryTree.vaporm0
-rw-r--r--output/BubbleSort.java93
-rw-r--r--output/BubbleSort.vapor223
-rw-r--r--output/BubbleSort.vaporm0
-rw-r--r--output/Factorial.java16
-rw-r--r--output/Factorial.vapor47
-rw-r--r--output/Factorial.vaporm138
-rw-r--r--output/LinearSearch.java99
-rw-r--r--output/LinearSearch.vapor188
-rw-r--r--output/LinearSearch.vaporm0
-rw-r--r--output/LinkedList.java278
-rw-r--r--output/LinkedList.vapor556
-rw-r--r--output/LinkedList.vaporm0
-rw-r--r--output/MoreThan4.java29
-rw-r--r--output/MoreThan4.vapor70
-rw-r--r--output/MoreThan4.vaporm0
-rw-r--r--output/QuickSort.java112
-rw-r--r--output/QuickSort.vapor305
-rw-r--r--output/QuickSort.vaporm0
-rw-r--r--output/TreeVisitor.java374
-rw-r--r--output/TreeVisitor.vapor896
-rw-r--r--output/TreeVisitor.vaporm0
-rw-r--r--output/ex29.java5
-rw-r--r--output/ex29.vapor10
-rw-r--r--output/ex29.vaporm42
-rw-r--r--output/ex30.java11
-rw-r--r--output/ex30.vapor17
-rw-r--r--output/ex30.vaporm65
-rw-r--r--output/ex31.java16
-rw-r--r--output/ex31.vapor25
-rw-r--r--output/ex31.vaporm90
-rw-r--r--output/ex32.java14
-rw-r--r--output/ex32.vapor29
-rw-r--r--output/ex32.vaporm103
-rw-r--r--output/ex33.java23
-rw-r--r--output/ex33.vapor52
-rw-r--r--output/ex33.vaporm167
-rw-r--r--output/ex34.java20
-rw-r--r--output/ex34.vapor30
-rw-r--r--output/ex34.vaporm100
-rw-r--r--output/ex35.java11
-rw-r--r--output/ex35.vapor26
-rw-r--r--output/ex35.vaporm96
-rw-r--r--output/ex36.java15
-rw-r--r--output/ex36.vapor28
-rw-r--r--output/ex36.vaporm98
-rw-r--r--output/ex37.java20
-rw-r--r--output/ex37.vapor40
-rw-r--r--output/ex37.vaporm108
-rw-r--r--output/ex38.java20
-rw-r--r--output/ex38.vapor40
-rw-r--r--output/ex38.vaporm108
-rw-r--r--output/ex39.java12
-rw-r--r--output/ex39.vapor27
-rw-r--r--output/ex39.vaporm59
-rw-r--r--output/ex40.java19
-rw-r--r--output/ex40.vapor32
-rw-r--r--output/ex40.vaporm102
-rw-r--r--output/ex41.java25
-rw-r--r--output/ex41.vapor54
-rw-r--r--output/ex41.vaporm122
-rw-r--r--output/ex42.vapor36
-rw-r--r--output/ex42.vaporm0
-rw-r--r--output/ex43.java22
-rw-r--r--output/ex43.vapor40
-rw-r--r--output/ex43.vaporm108
-rw-r--r--output/ex44.java16
-rw-r--r--output/ex44.vapor31
-rw-r--r--output/ex44.vaporm99
-rw-r--r--output/ex45.java19
-rw-r--r--output/ex45.vapor31
-rw-r--r--output/ex45.vaporm0
-rw-r--r--output/ex46.java32
-rw-r--r--output/ex46.vapor61
-rw-r--r--output/ex46.vaporm190
-rw-r--r--output/ex47.java24
-rw-r--r--output/ex47.vapor52
-rw-r--r--output/ex47.vaporm0
-rw-r--r--output/ex48.java23
-rw-r--r--output/ex48.vapor39
-rw-r--r--output/ex48.vaporm146
-rw-r--r--output/ex49.java26
-rw-r--r--output/ex49.vapor36
-rw-r--r--output/ex49.vaporm120
-rw-r--r--output/ex50.java35
-rw-r--r--output/ex50.vapor52
-rw-r--r--output/ex50.vaporm193
-rw-r--r--output/negative/ArrayEqualsBool-error.java381
-rw-r--r--output/negative/ArrayEqualsClass-error.java380
-rw-r--r--output/negative/AssignWrongType-error1.java378
-rw-r--r--output/negative/BadAdd-error1.java376
-rw-r--r--output/negative/BadAnd-error1.java376
-rw-r--r--output/negative/BadArrayAlloc-error1.java380
-rw-r--r--output/negative/BadCompare-error1.java376
-rw-r--r--output/negative/BadIf-error1.java376
-rw-r--r--output/negative/BadLookup-error1.java382
-rw-r--r--output/negative/BadLookup-error2.java382
-rw-r--r--output/negative/BadMinus-error1.java378
-rw-r--r--output/negative/BadMul-error1.java380
-rw-r--r--output/negative/BadPrint-error.java26
-rw-r--r--output/negative/BadWhile-error1.java376
-rw-r--r--output/negative/BinaryTree-error.java334
-rw-r--r--output/negative/BubbleSort-error.java93
-rw-r--r--output/negative/Factorial-error.java16
-rw-r--r--output/negative/ImpossibleLength-error.java379
-rw-r--r--output/negative/IndexNonArray-error1.java377
-rw-r--r--output/negative/LinearSearch-error.java99
-rw-r--r--output/negative/LinkedList-error.java278
-rw-r--r--output/negative/MissingAssign-error1.java377
-rw-r--r--output/negative/MissingCall-error1.java29
-rw-r--r--output/negative/MissingCall-error2.java112
-rw-r--r--output/negative/MissingCall-error3.java377
-rw-r--r--output/negative/NotASubType-error1.java384
-rw-r--r--output/negative/QuickSort-error.java112
-rw-r--r--output/negative/TreeVisitor-error.java376
-rw-r--r--output/negative/WrongReturn-error1.java378
120 files changed, 16502 insertions, 1098 deletions
diff --git a/.gitignore b/.gitignore
index 6282035..c9ee4cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,4 +9,3 @@
/*.dot
/test.vaporm
/cs132/
-/output/
diff --git a/heat/TypeCheckSimp.java b/heat/TypeCheckSimp.java
deleted file mode 100644
index 99fa187..0000000
--- a/heat/TypeCheckSimp.java
+++ /dev/null
@@ -1,1097 +0,0 @@
-package typecheck;
-
-import syntaxtree.*;
-import visitor.*;
-import st.*;
-import misc.*;
-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 TypeCheckSimp extends GJDepthFirst<TypeInstance,SymbolTable> {
-
- private int offset;
-
- private void printNode(Node n, SymbolTable symt, boolean enter, TypeEnum consensus) {
- String str = "";
- for (int i=0; i < this.offset; ++i)
- str += ".";
- if (enter)
- str += "Visiting ";
- else
- str += "Leaving ";
- str += "n.getClass().getSimpleName()";
- if (!enter) {
- if (consensus == TypeEnum.ERROR)
- str += " did not type check.";
- else
- str += String.format(" found type %s", consensus);
- }
- MinimalLogger.info(str);
- }
-
- public TypeInstance visit(NodeList n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = new TypeInstance(null, TypeEnum.CHECK);
- int _count=0;
- for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
- TypeInstance node = e.nextElement().accept(this,symt);
- e.nextElement().accept(this,symt);
- if (node.getType() == TypeEnum.ERROR)
- ret = node;
- _count++;
- }
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- public TypeInstance visit(NodeListOptional n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret;
- if ( n.present() ) {
- ret = new TypeInstance(null, TypeEnum.CHECK);
- int _count=0;
- for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
- TypeInstance node = e.nextElement().accept(this,symt);
- if (node.getType() == TypeEnum.ERROR)
- ret = node;
- _count++;
- }
- }
- else
- ret = new TypeInstance(null, TypeEnum.CHECK);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- // FIXME
- public TypeInstance visit(NodeOptional n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret;
-
- if ( n.present() )
- ret = n.node.accept(this,symt);
- else
- ret = new TypeInstance(null, TypeEnum.CHECK);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- public TypeInstance visit(NodeSequence n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = new TypeInstance(null, TypeEnum.CHECK);
- int _count=0;
- for ( Enumeration<Node> e = n.elements(); e.hasMoreElements(); ) {
- TypeInstance node = e.nextElement().accept(this,symt);
- if (node.getType() == TypeEnum.ERROR)
- ret = node;
- _count++;
- }
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- public TypeInstance visit(NodeToken n, SymbolTable symt) {
- // A fixed string token. '⌣'
- String str = "";
- for (int i=0; i < this.offset; ++i)
- str += ".";
- MinimalLogger.info(String.format("%sLeaving %s => %s",
- str,
- n.getClass().getSimpleName(),
- n.toString()));
- return null;
- }
-
- //
- // User-generated visitor methods below
- //
-
- /**
- * f0 -> MainClass()
- * f1 -> ( TypeDeclaration() )*
- * f2 -> <EOF>
- */
- public TypeInstance visit(Goal n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- n.f2.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- 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 TypeInstance visit(MainClass n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance name = n.f1.accept(this, symt);
- n.f2.accept(this, symt);
- n.f3.accept(this, symt);
- n.f4.accept(this, symt);
- n.f5.accept(this, symt);
- n.f6.accept(this, symt);
- n.f7.accept(this, symt);
- n.f8.accept(this, symt);
- n.f9.accept(this, symt);
- n.f10.accept(this, symt);
- // TypeInstance args = n.f11.accept(this, symt);
- n.f12.accept(this, symt);
- n.f13.accept(this, symt);
- TypeInstance var_dec = n.f14.accept(this, symt);
- TypeInstance stmt = n.f15.accept(this, symt);
- n.f16.accept(this, symt);
- n.f17.accept(this, symt);
-
- this.printNode(n, symt, false, stmt.getType());
- --this.offset;
- return stmt;
- }
-
- /**
- * f0 -> ClassDeclaration()
- * | ClassExtendsDeclaration()
- */
- public TypeInstance visit(TypeDeclaration n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> "class"
- * f1 -> Identifier()
- * f2 -> "{"
- * f3 -> ( VarDeclaration() )*
- * f4 -> ( MethodDeclaration() )*
- * f5 -> "}"
- */
- public TypeInstance visit(ClassDeclaration n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance id = n.f1.accept(this, symt);
- n.f2.accept(this, symt);
- TypeInstance vars = n.f3.accept(this, symt);
- TypeInstance mtds = n.f4.accept(this, symt);
- n.f5.accept(this, symt);
- TypeInstance ret = (vars.hasChecked() &&
- mtds.hasChecked()) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> "class"
- * f1 -> Identifier()
- * f2 -> "extends"
- * f3 -> Identifier()
- * f4 -> "{"
- * f5 -> ( VarDeclaration() )*
- * f6 -> ( MethodDeclaration() )*
- * f7 -> "}"
- */
- public TypeInstance visit(ClassExtendsDeclaration n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance id = n.f1.accept(this, symt);
- n.f2.accept(this, symt);
- TypeInstance ext = n.f3.accept(this, symt);
- n.f4.accept(this, symt);
- TypeInstance vars = n.f5.accept(this, symt);
- TypeInstance mehs = n.f6.accept(this, symt);
- n.f7.accept(this, symt);
- TypeInstance ret = (id.getType() == TypeEnum.classname &&
- vars.hasChecked() &&
- mehs.hasChecked()) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- // FIXME (this may be ST-only)
- /**
- * f0 -> Type()
- * f1 -> Identifier()
- * f2 -> ";"
- */
- public TypeInstance visit(VarDeclaration n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- n.f2.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- // FIXME
- /**
- * [7.5]: Parameters identifiers are distinct, local vars are distinct,
- * (vars in scope?), all statements type check
- *
- * f0 -> "public"
- * f1 -> Type()
- * f2 -> Identifier()
- * f3 -> "("
- * f4 -> ( FormalParameterList() )?
- * f5 -> ")"
- * f6 -> "{"
- * f7 -> ( VarDeclaration() )*
- * f8 -> ( Statement() )*
- * f9 -> "return"
- * f10 -> Expression()
- * f11 -> ";"
- * f12 -> "}"
- */
- public TypeInstance visit(MethodDeclaration n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- MethodInstance self = symt.getMethod(n.f2.f0.tokenImage);
- n.f0.accept(this, symt);
- TypeInstance ret_type = n.f1.accept(this, symt);
- n.f2.accept(this, symt);
- n.f3.accept(this, symt);
- n.f4.accept(this, symt);
- n.f5.accept(this, symt);
- n.f6.accept(this, symt);
- n.f7.accept(this, symt);
- TypeInstance stmt = n.f8.accept(this, symt);
- n.f9.accept(this, symt);
- TypeInstance rtrn = n.f10.accept(this, symt);
- n.f11.accept(this, symt);
- n.f12.accept(this, symt);
- TypeInstance ret = (self.getReturn() == rtrn.getType() && // FIXME I am checking that the rtrn matches the method's declared return type. Is this in the document?
- stmt.hasChecked()) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> FormalParameter()
- * f1 -> ( FormalParameterRest() )*
- */
- public TypeInstance visit(FormalParameterList n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance _ret=null;
- TypeInstance para1 = n.f0.accept(this, symt);
- TypeInstance parar = n.f1.accept(this, symt);
- TypeInstance ret = (para1.hasChecked() &&
- parar.hasChecked()) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> Type()
- * f1 -> Identifier()
- */
- public TypeInstance visit(FormalParameter n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> ","
- * f1 -> FormalParameter()
- */
- public TypeInstance visit(FormalParameterRest n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance ret = n.f1.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> ArrayType()
- * | BooleanType()
- * | IntegerType()
- * | Identifier()
- */
- public TypeInstance visit(Type n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> "int"
- * f1 -> "["
- * f2 -> "]"
- */
- public TypeInstance visit(ArrayType n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = new TypeInstance(null, TypeEnum.intarray);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> "boolean"
- */
- public TypeInstance visit(BooleanType n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = new TypeInstance(null, TypeEnum.bool);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> "int"
- */
- public TypeInstance visit(IntegerType n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = new TypeInstance(null, TypeEnum.integer);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> Block()
- * | AssignmentStatement()
- * | ArrayAssignmentStatement()
- * | IfStatement()
- * | WhileStatement()
- * | PrintStatement()
- */
- public TypeInstance visit(Statement n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> "{"
- * f1 -> ( Statement() )*
- * f2 -> "}"
- */
- public TypeInstance visit(Block n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance ret = n.f1.accept(this, symt);
- n.f2.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- // FIXME FIXME FIXME
- // Given we only have a few types, what is a subtype of what?
- /**
- * [23]: Expression is a subtype of identifier, and e typechecks*
- *
- * f0 -> Identifier()
- * f1 -> "="
- * f2 -> Expression()
- * f3 -> ";"
- */
- public TypeInstance visit(AssignmentStatement n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance lhs = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance rhs = n.f2.accept(this, symt);
- n.f3.accept(this, symt);
- TypeInstance ret = (lhs.sameType(rhs)) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- // FIXME (this may be done)
- /**
- * [24]: Identifier is an integer array, expressions are both integers
- *
- * f0 -> Identifier()
- * f1 -> "["
- * f2 -> Expression()
- * f3 -> "]"
- * f4 -> "="
- * f5 -> Expression()
- * f6 -> ";"
- */
- public TypeInstance visit(ArrayAssignmentStatement n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance id = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance index = n.f2.accept(this, symt);
- n.f3.accept(this, symt);
- n.f4.accept(this, symt);
- TypeInstance value = n.f5.accept(this, symt);
- n.f6.accept(this, symt);
- TypeInstance ret = (id.getType() == TypeEnum.intarray &&
- index.getType() == TypeEnum.integer &&
- value.getType() == TypeEnum.integer) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [25]: Expression is a bool, both statements type-check
- *
- * f0 -> "if"
- * f1 -> "("
- * f2 -> Expression()
- * f3 -> ")"
- * f4 -> Statement()
- * f5 -> "else"
- * f6 -> Statement()
- */
- public TypeInstance visit(IfStatement n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance expr = n.f2.accept(this, symt);
- n.f3.accept(this, symt);
- TypeInstance stmt1 = n.f4.accept(this, symt);
- n.f5.accept(this, symt);
- TypeInstance stmt2 = n.f6.accept(this, symt);
- TypeInstance ret = (expr.getType() == TypeEnum.bool &&
- stmt1.getType() == stmt2.getType() &&
- stmt1.hasChecked()) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
-
- }
-
- /**
- * DONE [26]: Expression is a bool, statement type-checks
- *
- * f0 -> "while"
- * f1 -> "("
- * f2 -> Expression()
- * f3 -> ")"
- * f4 -> Statement()
- */
- public TypeInstance visit(WhileStatement n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance expr = n.f2.accept(this, symt);
- n.f3.accept(this, symt);
- TypeInstance stmt = n.f4.accept(this, symt);
- TypeInstance ret = (expr.getType() == TypeEnum.bool &&
- stmt.hasChecked()) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [27]: Expression is an integer
- *
- * f0 -> "System.out.println"
- * f1 -> "("
- * f2 -> Expression()
- * f3 -> ")"
- * f4 -> ";"
- */
- public TypeInstance visit(PrintStatement n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance ret = n.f2.accept(this, symt);
- n.f3.accept(this, symt);
- n.f4.accept(this, symt);
- ret = (ret.getType() == TypeEnum.integer) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> AndExpression()
- * | CompareExpression()
- * | PlusExpression()
- * | MinusExpression()
- * | TimesExpression()
- * | ArrayLookup()
- * | ArrayLength()
- * | MessageSend()
- * | PrimaryExpression()
- */
- public TypeInstance visit(Expression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [28]: If expressions are both booleans, return is a boolean
- *
- * f0 -> PrimaryExpression()
- * f1 -> "&&"
- * f2 -> PrimaryExpression()
- */
- public TypeInstance visit(AndExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance oper1 = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance oper2 = n.f2.accept(this, symt);
- TypeInstance ret = (oper1.getType() == TypeEnum.bool &&
- oper2.getType() == TypeEnum.bool) ?
- new TypeInstance(null, TypeEnum.bool) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [29]: If expressions are both integers, return is a boolean
- *
- * f0 -> PrimaryExpression()
- * f1 -> "<"
- * f2 -> PrimaryExpression()
- */
- public TypeInstance visit(CompareExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance oper1 = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance oper2 = n.f2.accept(this, symt);
- TypeInstance ret = (oper1.getType() == TypeEnum.integer &&
- oper2.getType() == TypeEnum.integer) ?
- new TypeInstance(null, TypeEnum.bool) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [30]: If expressions are both integers, return is an integer
- *
- * f0 -> PrimaryExpression()
- * f1 -> "+"
- * f2 -> PrimaryExpression()
- */
- public TypeInstance visit(PlusExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance oper1 = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance oper2 = n.f2.accept(this, symt);
- TypeInstance ret = (oper1.getType() == TypeEnum.integer &&
- oper2.getType() == TypeEnum.integer) ?
- new TypeInstance(null, TypeEnum.integer) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [31]: If expressions are both integers, return is an integer
- *
- * f0 -> PrimaryExpression()
- * f1 -> "-"
- * f2 -> PrimaryExpression()
- */
- public TypeInstance visit(MinusExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance oper1 = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance oper2 = n.f2.accept(this, symt);
- TypeInstance ret = (oper1.getType() == TypeEnum.integer &&
- oper2.getType() == TypeEnum.integer) ?
- new TypeInstance(null, TypeEnum.integer) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [32]: If expressions are both integers, return is an integer
- *
- * f0 -> PrimaryExpression()
- * f1 -> "*"
- * f2 -> PrimaryExpression()
- */
- public TypeInstance visit(TimesExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance oper1 = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance oper2 = n.f2.accept(this, symt);
- TypeInstance ret = (oper1.getType() == TypeEnum.integer &&
- oper2.getType() == TypeEnum.integer) ?
- new TypeInstance(null, TypeEnum.integer) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [33]: If expr1 is an integer array and expr2 is an int,
- * return is an int
- *
- * f0 -> PrimaryExpression()
- * f1 -> "["
- * f2 -> PrimaryExpression()
- * f3 -> "]"
- */
- public TypeInstance visit(ArrayLookup n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance array = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- TypeInstance index = n.f2.accept(this, symt);
- n.f3.accept(this, symt);
- TypeInstance ret = (array.getType() == TypeEnum.intarray &&
- index.getType() == TypeEnum.integer) ?
- new TypeInstance(null, TypeEnum.integer) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [34]: If expr1 is an integer array, return is an int
- *
- * f0 -> PrimaryExpression()
- * f1 -> "."
- * f2 -> "length"
- */
- public TypeInstance visit(ArrayLength n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- n.f2.accept(this, symt);
- ret = (ret.getType() == TypeEnum.intarray) ? new TypeInstance(null, TypeEnum.integer) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- // FIXME FIXME FIXME
- /**
- * [35]: PrimaryExpr must be a classname, id must be a method name, expressionlist must be correct?
- *
- * f0 -> PrimaryExpression()
- * f1 -> "."
- * f2 -> Identifier()
- * f3 -> "("
- * f4 -> ( ExpressionList() )?
- * f5 -> ")"
- */
- public TypeInstance visit(MessageSend n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- // this MUST be an instance of a class!
- TypeInstance t = n.f0.accept(this, symt);
- ClassInstance c = t.getClassInstance();
- n.f1.accept(this, symt);
- n.f2.accept(this, symt);
- MethodInstance m = symt.getMethod(n.f2.f0.tokenImage);
- n.f3.accept(this, symt);
- n.f4.accept(this, symt);
- n.f5.accept(this, symt);
- --this.offset;
- return (true) ?
- new TypeInstance(null, m.getReturn()) :
- new TypeInstance(null, TypeEnum.ERROR);
- }
-
- // FIXME
- /**
- * f0 -> Expression()
- * f1 -> ( ExpressionRest() )*
- */
- public TypeInstance visit(ExpressionList n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance expr1 = n.f0.accept(this, symt);
- TypeInstance exprr = n.f1.accept(this, symt);
- TypeInstance ret = (expr1.hasChecked() &&
- exprr.hasChecked()) ?
- new TypeInstance(null, TypeEnum.CHECK) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> ","
- * f1 -> Expression()
- */
- public TypeInstance visit(ExpressionRest n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance ret = n.f1.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * f0 -> IntegerLiteral()
- * | TrueLiteral()
- * | FalseLiteral()
- * | Identifier()
- * | ThisExpression()
- * | ArrayAllocationExpression()
- * | AllocationExpression()
- * | NotExpression()
- * | BracketExpression()
- */
- public TypeInstance visit(PrimaryExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance ret = n.f0.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [36]: return is an int
- *
- *
- * f0 -> <INTEGER_LITERAL>
- */
- public TypeInstance visit(IntegerLiteral n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- this.printNode(n, symt, false, TypeEnum.integer);
- --this.offset;
- return new TypeInstance(null, TypeEnum.integer);
- }
-
- /**
- * DONE [37]: return is a bool
- *
- * f0 -> "true"
- */
- public TypeInstance visit(TrueLiteral n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- this.printNode(n, symt, false, TypeEnum.bool);
- --this.offset;
- return new TypeInstance(null, TypeEnum.bool);
- }
-
- /**
- * DONE [38]: return is a bool
- *
- * f0 -> "false"
- */
- public TypeInstance visit(FalseLiteral n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- this.printNode(n, symt, false, TypeEnum.bool);
- --this.offset;
- return new TypeInstance(null, TypeEnum.bool);
- }
-
- // FIXME
- /**
- * [39]: id is a symbol in the current domain, return is id's type
- *
- * f0 -> <IDENTIFIER>
- */
- public TypeInstance visit(Identifier n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- TypeInstance type;
- TypeInstance ret;
- ClassInstance cls;
- if ((cls = symt.getClass(n.f0.tokenImage)) != null) {
- // covers "anonymous" instance
- ret = new TypeInstance(cls.getName(),
- TypeEnum.classname);
- ret.addClassInstance(cls);
- } else {
- if ((type = symt.getType(n.f0.tokenImage)) != null) {
- ret = new TypeInstance(type.getName(),
- type.getType());
- ret.addClassInstance(type.getClassInstance());
- } else
- ret = new TypeInstance(null, TypeEnum.ERROR);
- }
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- // FIXME FIXME FIXME
- /**
- * [40]: method exists? but where is the token?
- *
- * f0 -> "this"
- */
- public TypeInstance visit(ThisExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance ret = new TypeInstance(null, TypeEnum.CHECK);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * DONE [41]: if expression is an integer, return is an int array
- *
- * f0 -> "new"
- * f1 -> "int"
- * f2 -> "["
- * f3 -> Expression()
- * f4 -> "]"
- */
- public TypeInstance visit(ArrayAllocationExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- n.f1.accept(this, symt);
- n.f2.accept(this, symt);
- TypeInstance ret = n.f3.accept(this, symt);
- n.f4.accept(this, symt);
- ret = (ret.getType() == TypeEnum.integer) ? new TypeInstance(null, TypeEnum.intarray) :
- new TypeInstance(null, TypeEnum.ERROR);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- // FIXME
- /**
- * [42]:
- *
- * f0 -> "new"
- * f1 -> Identifier()
- * f2 -> "("
- * f3 -> ")"
- */
- public TypeInstance visit(AllocationExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance ret = n.f1.accept(this, symt);
- n.f2.accept(this, symt);
- n.f3.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
- /**
- * [43]: if expression is a boolean, return is a boolean
- *
- * f0 -> "!"
- * f1 -> Expression()
- */
- public TypeInstance visit(NotExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance ret = n.f1.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return (ret.getType() == TypeEnum.bool) ? ret : new TypeInstance(null, TypeEnum.ERROR);
- }
-
- /**
- * [44]: if e is a type, return is that same type
- *
- * f0 -> "("
- * f1 -> Expression()
- * f2 -> ")"
- */
- public TypeInstance visit(BracketExpression n, SymbolTable symt) {
- ++this.offset;
- this.printNode(n, symt, true, null);
-
- n.f0.accept(this, symt);
- TypeInstance ret = n.f1.accept(this, symt);
- n.f2.accept(this, symt);
-
- this.printNode(n, symt, false, ret.getType());
- --this.offset;
- return ret;
- }
-
-}
diff --git a/output/BinaryTree.java b/output/BinaryTree.java
new file mode 100644
index 0000000..18d1464
--- /dev/null
+++ b/output/BinaryTree.java
@@ -0,0 +1,334 @@
+class BinaryTree{
+ public static void main(String[] a){
+ System.out.println(new BT().Start());
+ }
+}
+
+
+// This class invokes the methods to create a tree,
+// insert, delete and serach for elements on it
+class BT {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Print();
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+ // Initialize a node with a key value and no children
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ // Update the right child with rn
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ // Update the left child with ln
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ // This method compares two integers and
+ // returns true if they are equal and false
+ // otherwise
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+
+ // Insert a new element in the tree
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ boolean cont ;
+ int key_aux ;
+ Tree current_node ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+
+ // Delete an element from the tree
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean is_root ;
+ int key_aux ;
+ boolean ntb ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if ((!current_node.GetHas_Right()) &&
+ (!current_node.GetHas_Left()) )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+
+ // Check if the element to be removed will use the
+ // righ or left subtree if one exists
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ //auxtree01 = p_node.GetLeft() ;
+ //auxkey2 = auxtree01.GetKey() ;
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+
+ // Copy the child key to the parent until a leaf is
+ // found and remove the leaf. This is done with the
+ // right subtree
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+
+ while (c_node.GetHas_Right()){
+ //auxtree01 = c_node.GetRight() ;
+ //auxint02 = auxtree01.GetKey();
+ //ntb = c_node.SetKey(auxint02);
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+
+ // Copy the child key to the parent until a leaf is
+ // found and remove the leaf. This is done with the
+ // left subtree
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+
+ while (c_node.GetHas_Left()){
+ //auxtree01 = c_node.GetLeft() ;
+ //auxint02 = auxtree01.GetKey();
+ //ntb = c_node.SetKey(auxint02);
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+ // Search for an elemnt in the tree
+ public int Search(int v_key){
+ boolean cont ;
+ int ifound ;
+ Tree current_node;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ // Invoke the method to really print the tree elements
+ public boolean Print(){
+ Tree current_node;
+ boolean ntb ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ // Print the elements of the tree
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ //auxtree01 = node.GetLeft() ;
+ //ntb = this.RecPrint(auxtree01);
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ //auxtree01 = node.GetRight() ;
+ //ntb = this.RecPrint(auxtree01);
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+}
+
diff --git a/output/BinaryTree.vapor b/output/BinaryTree.vapor
new file mode 100644
index 0000000..60719bf
--- /dev/null
+++ b/output/BinaryTree.vapor
@@ -0,0 +1,764 @@
+func Main()
+ t.3 = HeapAllocZ(4)
+ [t.3+0] = :functable_BT
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.2 = call t.6(t.4 )
+ t.7 = t.2
+ PrintIntS(t.7)
+ ret
+
+const functable_BT
+ :BT_Start
+
+func BT_Start(this )
+ t.2 = HeapAllocZ(104)
+ [t.2+0] = :functable_Tree
+ t.1 = t.2
+ t.1 = t.1
+ t.5 = [t.1+0]
+ t.6 = [t.5+0]
+ t.7 = 16
+ t.4 = call t.6(t.1 t.7)
+ t.3 = t.4
+ t.1 = t.1
+ t.9 = [t.1+0]
+ t.10 = [t.9+72]
+ t.8 = call t.10(t.1 )
+ t.3 = t.8
+ t.11 = 100000000
+ PrintIntS(t.11)
+ t.1 = t.1
+ t.13 = [t.1+0]
+ t.14 = [t.13+48]
+ t.15 = 8
+ t.12 = call t.14(t.1 t.15)
+ t.3 = t.12
+ t.1 = t.1
+ t.17 = [t.1+0]
+ t.18 = [t.17+72]
+ t.16 = call t.18(t.1 )
+ t.3 = t.16
+ t.1 = t.1
+ t.20 = [t.1+0]
+ t.21 = [t.20+48]
+ t.22 = 24
+ t.19 = call t.21(t.1 t.22)
+ t.3 = t.19
+ t.1 = t.1
+ t.24 = [t.1+0]
+ t.25 = [t.24+48]
+ t.26 = 4
+ t.23 = call t.25(t.1 t.26)
+ t.3 = t.23
+ t.1 = t.1
+ t.28 = [t.1+0]
+ t.29 = [t.28+48]
+ t.30 = 12
+ t.27 = call t.29(t.1 t.30)
+ t.3 = t.27
+ t.1 = t.1
+ t.32 = [t.1+0]
+ t.33 = [t.32+48]
+ t.34 = 20
+ t.31 = call t.33(t.1 t.34)
+ t.3 = t.31
+ t.1 = t.1
+ t.36 = [t.1+0]
+ t.37 = [t.36+48]
+ t.38 = 28
+ t.35 = call t.37(t.1 t.38)
+ t.3 = t.35
+ t.1 = t.1
+ t.40 = [t.1+0]
+ t.41 = [t.40+48]
+ t.42 = 14
+ t.39 = call t.41(t.1 t.42)
+ t.3 = t.39
+ t.1 = t.1
+ t.44 = [t.1+0]
+ t.45 = [t.44+72]
+ t.43 = call t.45(t.1 )
+ t.3 = t.43
+ t.1 = t.1
+ t.47 = [t.1+0]
+ t.48 = [t.47+68]
+ t.49 = 24
+ t.46 = call t.48(t.1 t.49)
+ t.50 = t.46
+ PrintIntS(t.50)
+ t.1 = t.1
+ t.52 = [t.1+0]
+ t.53 = [t.52+68]
+ t.54 = 12
+ t.51 = call t.53(t.1 t.54)
+ t.55 = t.51
+ PrintIntS(t.55)
+ t.1 = t.1
+ t.57 = [t.1+0]
+ t.58 = [t.57+68]
+ t.59 = 16
+ t.56 = call t.58(t.1 t.59)
+ t.60 = t.56
+ PrintIntS(t.60)
+ t.1 = t.1
+ t.62 = [t.1+0]
+ t.63 = [t.62+68]
+ t.64 = 50
+ t.61 = call t.63(t.1 t.64)
+ t.65 = t.61
+ PrintIntS(t.65)
+ t.1 = t.1
+ t.67 = [t.1+0]
+ t.68 = [t.67+68]
+ t.69 = 12
+ t.66 = call t.68(t.1 t.69)
+ t.70 = t.66
+ PrintIntS(t.70)
+ t.1 = t.1
+ t.72 = [t.1+0]
+ t.73 = [t.72+52]
+ t.74 = 12
+ t.71 = call t.73(t.1 t.74)
+ t.3 = t.71
+ t.1 = t.1
+ t.76 = [t.1+0]
+ t.77 = [t.76+72]
+ t.75 = call t.77(t.1 )
+ t.3 = t.75
+ t.1 = t.1
+ t.79 = [t.1+0]
+ t.80 = [t.79+68]
+ t.81 = 12
+ t.78 = call t.80(t.1 t.81)
+ t.82 = t.78
+ PrintIntS(t.82)
+ t.83 = 0
+ ret t.83
+
+const functable_Tree
+ :Tree_Init
+ :Tree_SetRight
+ :Tree_SetLeft
+ :Tree_GetRight
+ :Tree_GetLeft
+ :Tree_GetKey
+ :Tree_SetKey
+ :Tree_GetHas_Right
+ :Tree_GetHas_Left
+ :Tree_SetHas_Left
+ :Tree_SetHas_Right
+ :Tree_Compare
+ :Tree_Insert
+ :Tree_Delete
+ :Tree_Remove
+ :Tree_RemoveRight
+ :Tree_RemoveLeft
+ :Tree_Search
+ :Tree_Print
+ :Tree_RecPrint
+
+func Tree_Init(this t.0 )
+ [this+88] = t.0
+ [this+92] = 0
+ [this+96] = 0
+ t.1 = 1
+ ret t.1
+
+func Tree_SetRight(this t.0 )
+ [this+84] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_SetLeft(this t.0 )
+ [this+80] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_GetRight(this )
+ t.0 = [this+84]
+ ret t.0
+
+func Tree_GetLeft(this )
+ t.0 = [this+80]
+ ret t.0
+
+func Tree_GetKey(this )
+ t.0 = [this+88]
+ ret t.0
+
+func Tree_SetKey(this t.0 )
+ [this+88] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_GetHas_Right(this )
+ t.0 = [this+96]
+ ret t.0
+
+func Tree_GetHas_Left(this )
+ t.0 = [this+92]
+ ret t.0
+
+func Tree_SetHas_Left(this t.0 )
+ [this+92] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_SetHas_Right(this t.0 )
+ [this+96] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_Compare(this t.0 t.1 )
+ t.2 = 0
+ t.5 = t.1
+ t.6 = 1
+ t.4 = Add(t.5 t.6)
+ t.3 = t.4
+ t.8 = t.0
+ t.9 = t.1
+ t.7 = LtS(t.8 t.9)
+ t.10 = t.7
+ if0 t.10 goto :if100_else
+if100_body:
+ t.2 = 0
+ goto :if100_end
+if100_else:
+ t.13 = t.0
+ t.14 = t.3
+ t.12 = LtS(t.13 t.14)
+ t.11 = Eq(t.12 0)
+ t.15 = t.11
+ if0 t.15 goto :if104_else
+if104_body:
+ t.2 = 0
+ goto :if104_end
+if104_else:
+ t.2 = 1
+if104_end:
+if100_end:
+ t.16 = t.2
+ ret t.16
+
+func Tree_Insert(this t.0 )
+ t.3 = HeapAllocZ(104)
+ [t.3+0] = :functable_Tree
+ t.2 = t.3
+ t.2 = t.2
+ t.6 = [t.2+0]
+ t.7 = [t.6+0]
+ t.8 = t.0
+ t.5 = call t.7(t.2 t.8)
+ t.4 = t.5
+ t.9 = this
+ t.10 = 1
+while115_test:
+ t.11 = t.10
+ if0 t.11 goto :while115_end
+while115_body:
+ t.9 = t.9
+ t.14 = [t.9+0]
+ t.15 = [t.14+20]
+ t.13 = call t.15(t.9 )
+ t.12 = t.13
+ t.17 = t.0
+ t.18 = t.12
+ t.16 = LtS(t.17 t.18)
+ t.19 = t.16
+ if0 t.19 goto :if120_else
+if120_body:
+ t.9 = t.9
+ t.21 = [t.9+0]
+ t.22 = [t.21+32]
+ t.20 = call t.22(t.9 )
+ t.23 = t.20
+ if0 t.23 goto :if124_else
+if124_body:
+ t.9 = t.9
+ t.25 = [t.9+0]
+ t.26 = [t.25+16]
+ t.24 = call t.26(t.9 )
+ t.9 = t.24
+ goto :if124_end
+if124_else:
+ t.10 = 0
+ t.9 = t.9
+ t.28 = [t.9+0]
+ t.29 = [t.28+36]
+ t.30 = 1
+ t.27 = call t.29(t.9 t.30)
+ t.4 = t.27
+ t.9 = t.9
+ t.32 = [t.9+0]
+ t.33 = [t.32+8]
+ t.34 = t.2
+ t.31 = call t.33(t.9 t.34)
+ t.4 = t.31
+if124_end:
+ goto :if120_end
+if120_else:
+ t.9 = t.9
+ t.36 = [t.9+0]
+ t.37 = [t.36+28]
+ t.35 = call t.37(t.9 )
+ t.38 = t.35
+ if0 t.38 goto :if139_else
+if139_body:
+ t.9 = t.9
+ t.40 = [t.9+0]
+ t.41 = [t.40+12]
+ t.39 = call t.41(t.9 )
+ t.9 = t.39
+ goto :if139_end
+if139_else:
+ t.10 = 0
+ t.9 = t.9
+ t.43 = [t.9+0]
+ t.44 = [t.43+40]
+ t.45 = 1
+ t.42 = call t.44(t.9 t.45)
+ t.4 = t.42
+ t.9 = t.9
+ t.47 = [t.9+0]
+ t.48 = [t.47+4]
+ t.49 = t.2
+ t.46 = call t.48(t.9 t.49)
+ t.4 = t.46
+if139_end:
+if120_end:
+ goto :while115_test
+while115_end:
+ t.50 = 1
+ ret t.50
+
+func Tree_Delete(this t.0 )
+ t.2 = this
+ t.3 = this
+ t.4 = 1
+ t.5 = 0
+ t.6 = 1
+while155_test:
+ t.7 = t.4
+ if0 t.7 goto :while155_end
+while155_body:
+ t.2 = t.2
+ t.10 = [t.2+0]
+ t.11 = [t.10+20]
+ t.9 = call t.11(t.2 )
+ t.8 = t.9
+ t.13 = t.0
+ t.14 = t.8
+ t.12 = LtS(t.13 t.14)
+ t.15 = t.12
+ if0 t.15 goto :if160_else
+if160_body:
+ t.2 = t.2
+ t.17 = [t.2+0]
+ t.18 = [t.17+32]
+ t.16 = call t.18(t.2 )
+ t.19 = t.16
+ if0 t.19 goto :if164_else
+if164_body:
+ t.3 = t.2
+ t.2 = t.2
+ t.21 = [t.2+0]
+ t.22 = [t.21+16]
+ t.20 = call t.22(t.2 )
+ t.2 = t.20
+ goto :if164_end
+if164_else:
+ t.4 = 0
+if164_end:
+ goto :if160_end
+if160_else:
+ t.24 = t.8
+ t.25 = t.0
+ t.23 = LtS(t.24 t.25)
+ t.26 = t.23
+ if0 t.26 goto :if171_else
+if171_body:
+ t.2 = t.2
+ t.28 = [t.2+0]
+ t.29 = [t.28+28]
+ t.27 = call t.29(t.2 )
+ t.30 = t.27
+ if0 t.30 goto :if175_else
+if175_body:
+ t.3 = t.2
+ t.2 = t.2
+ t.32 = [t.2+0]
+ t.33 = [t.32+12]
+ t.31 = call t.33(t.2 )
+ t.2 = t.31
+ goto :if175_end
+if175_else:
+ t.4 = 0
+if175_end:
+ goto :if171_end
+if171_else:
+ t.34 = t.6
+ if0 t.34 goto :if182_else
+if182_body:
+ t.2 = t.2
+ t.38 = [t.2+0]
+ t.39 = [t.38+28]
+ t.37 = call t.39(t.2 )
+ t.36 = Eq(t.37 0)
+ t.40 = t.36
+ t.2 = t.2
+ t.43 = [t.2+0]
+ t.44 = [t.43+32]
+ t.42 = call t.44(t.2 )
+ t.41 = Eq(t.42 0)
+ t.45 = t.41
+ t.46 = Eq(1 t.40)
+ t.47 = Eq(1 t.45)
+ t.35 = Eq(t.46 t.47)
+ t.48 = t.35
+ if0 t.48 goto :if183_else
+if183_body:
+ t.49 = 1
+ goto :if183_end
+if183_else:
+ t.51 = [this]
+ t.52 = t.3
+ t.53 = t.2
+ t.51 = [t.51+56]
+ t.50 = call t.51(this t.52 t.53)
+ t.49 = t.50
+if183_end:
+ goto :if182_end
+if182_else:
+ t.55 = [this]
+ t.56 = t.3
+ t.57 = t.2
+ t.55 = [t.55+56]
+ t.54 = call t.55(this t.56 t.57)
+ t.49 = t.54
+if182_end:
+ t.5 = 1
+ t.4 = 0
+if171_end:
+if160_end:
+ t.6 = 0
+ goto :while155_test
+while155_end:
+ t.58 = t.5
+ ret t.58
+
+func Tree_Remove(this t.0 t.1 )
+ t.1 = t.1
+ t.3 = [t.1+0]
+ t.4 = [t.3+32]
+ t.2 = call t.4(t.1 )
+ t.5 = t.2
+ if0 t.5 goto :if206_else
+if206_body:
+ t.8 = [this]
+ t.9 = t.0
+ t.10 = t.1
+ t.8 = [t.8+64]
+ t.7 = call t.8(this t.9 t.10)
+ t.6 = t.7
+ goto :if206_end
+if206_else:
+ t.1 = t.1
+ t.12 = [t.1+0]
+ t.13 = [t.12+28]
+ t.11 = call t.13(t.1 )
+ t.14 = t.11
+ if0 t.14 goto :if214_else
+if214_body:
+ t.16 = [this]
+ t.17 = t.0
+ t.18 = t.1
+ t.16 = [t.16+60]
+ t.15 = call t.16(this t.17 t.18)
+ t.6 = t.15
+ goto :if214_end
+if214_else:
+ t.1 = t.1
+ t.21 = [t.1+0]
+ t.22 = [t.21+20]
+ t.20 = call t.22(t.1 )
+ t.19 = t.20
+ t.0 = t.0
+ t.26 = [t.0+0]
+ t.27 = [t.26+16]
+ t.25 = call t.27(t.0 )
+ t.28 = t.25
+ t.29 = [t.28+0]
+ t.30 = [t.29+20]
+ t.24 = call t.30(t.28 )
+ t.23 = t.24
+ t.32 = [this]
+ t.33 = t.19
+ t.34 = t.23
+ t.32 = [t.32+44]
+ t.31 = call t.32(this t.33 t.34)
+ t.35 = t.31
+ if0 t.35 goto :if232_else
+if232_body:
+ t.0 = t.0
+ t.37 = [t.0+0]
+ t.38 = [t.37+8]
+ t.39 = [this+100]
+ t.36 = call t.38(t.0 t.39)
+ t.6 = t.36
+ t.0 = t.0
+ t.41 = [t.0+0]
+ t.42 = [t.41+36]
+ t.43 = 0
+ t.40 = call t.42(t.0 t.43)
+ t.6 = t.40
+ goto :if232_end
+if232_else:
+ t.0 = t.0
+ t.45 = [t.0+0]
+ t.46 = [t.45+4]
+ t.47 = [this+100]
+ t.44 = call t.46(t.0 t.47)
+ t.6 = t.44
+ t.0 = t.0
+ t.49 = [t.0+0]
+ t.50 = [t.49+40]
+ t.51 = 0
+ t.48 = call t.50(t.0 t.51)
+ t.6 = t.48
+if232_end:
+if214_end:
+if206_end:
+ t.52 = 1
+ ret t.52
+
+func Tree_RemoveRight(this t.0 t.1 )
+while254_test:
+ t.1 = t.1
+ t.3 = [t.1+0]
+ t.4 = [t.3+28]
+ t.2 = call t.4(t.1 )
+ t.5 = t.2
+ if0 t.5 goto :while254_end
+while254_body:
+ t.1 = t.1
+ t.8 = [t.1+0]
+ t.9 = [t.8+24]
+ t.1 = t.1
+ t.12 = [t.1+0]
+ t.13 = [t.12+12]
+ t.11 = call t.13(t.1 )
+ t.14 = t.11
+ t.15 = [t.14+0]
+ t.16 = [t.15+20]
+ t.10 = call t.16(t.14 )
+ t.17 = t.10
+ t.7 = call t.9(t.1 t.17)
+ t.6 = t.7
+ t.0 = t.1
+ t.1 = t.1
+ t.19 = [t.1+0]
+ t.20 = [t.19+12]
+ t.18 = call t.20(t.1 )
+ t.1 = t.18
+ goto :while254_test
+while254_end:
+ t.0 = t.0
+ t.22 = [t.0+0]
+ t.23 = [t.22+4]
+ t.24 = [this+100]
+ t.21 = call t.23(t.0 t.24)
+ t.6 = t.21
+ t.0 = t.0
+ t.26 = [t.0+0]
+ t.27 = [t.26+40]
+ t.28 = 0
+ t.25 = call t.27(t.0 t.28)
+ t.6 = t.25
+ t.29 = 1
+ ret t.29
+
+func Tree_RemoveLeft(this t.0 t.1 )
+while282_test:
+ t.1 = t.1
+ t.3 = [t.1+0]
+ t.4 = [t.3+32]
+ t.2 = call t.4(t.1 )
+ t.5 = t.2
+ if0 t.5 goto :while282_end
+while282_body:
+ t.1 = t.1
+ t.8 = [t.1+0]
+ t.9 = [t.8+24]
+ t.1 = t.1
+ t.12 = [t.1+0]
+ t.13 = [t.12+16]
+ t.11 = call t.13(t.1 )
+ t.14 = t.11
+ t.15 = [t.14+0]
+ t.16 = [t.15+20]
+ t.10 = call t.16(t.14 )
+ t.17 = t.10
+ t.7 = call t.9(t.1 t.17)
+ t.6 = t.7
+ t.0 = t.1
+ t.1 = t.1
+ t.19 = [t.1+0]
+ t.20 = [t.19+16]
+ t.18 = call t.20(t.1 )
+ t.1 = t.18
+ goto :while282_test
+while282_end:
+ t.0 = t.0
+ t.22 = [t.0+0]
+ t.23 = [t.22+8]
+ t.24 = [this+100]
+ t.21 = call t.23(t.0 t.24)
+ t.6 = t.21
+ t.0 = t.0
+ t.26 = [t.0+0]
+ t.27 = [t.26+36]
+ t.28 = 0
+ t.25 = call t.27(t.0 t.28)
+ t.6 = t.25
+ t.29 = 1
+ ret t.29
+
+func Tree_Search(this t.0 )
+ t.2 = this
+ t.3 = 1
+ t.4 = 0
+while310_test:
+ t.5 = t.3
+ if0 t.5 goto :while310_end
+while310_body:
+ t.2 = t.2
+ t.8 = [t.2+0]
+ t.9 = [t.8+20]
+ t.7 = call t.9(t.2 )
+ t.6 = t.7
+ t.11 = t.0
+ t.12 = t.6
+ t.10 = LtS(t.11 t.12)
+ t.13 = t.10
+ if0 t.13 goto :if315_else
+if315_body:
+ t.2 = t.2
+ t.15 = [t.2+0]
+ t.16 = [t.15+32]
+ t.14 = call t.16(t.2 )
+ t.17 = t.14
+ if0 t.17 goto :if319_else
+if319_body:
+ t.2 = t.2
+ t.19 = [t.2+0]
+ t.20 = [t.19+16]
+ t.18 = call t.20(t.2 )
+ t.2 = t.18
+ goto :if319_end
+if319_else:
+ t.3 = 0
+if319_end:
+ goto :if315_end
+if315_else:
+ t.22 = t.6
+ t.23 = t.0
+ t.21 = LtS(t.22 t.23)
+ t.24 = t.21
+ if0 t.24 goto :if326_else
+if326_body:
+ t.2 = t.2
+ t.26 = [t.2+0]
+ t.27 = [t.26+28]
+ t.25 = call t.27(t.2 )
+ t.28 = t.25
+ if0 t.28 goto :if330_else
+if330_body:
+ t.2 = t.2
+ t.30 = [t.2+0]
+ t.31 = [t.30+12]
+ t.29 = call t.31(t.2 )
+ t.2 = t.29
+ goto :if330_end
+if330_else:
+ t.3 = 0
+if330_end:
+ goto :if326_end
+if326_else:
+ t.4 = 1
+ t.3 = 0
+if326_end:
+if315_end:
+ goto :while310_test
+while310_end:
+ t.32 = t.4
+ ret t.32
+
+func Tree_Print(this )
+ t.1 = this
+ t.4 = [this]
+ t.5 = t.1
+ t.4 = [t.4+76]
+ t.3 = call t.4(this t.5)
+ t.2 = t.3
+ t.6 = 1
+ ret t.6
+
+func Tree_RecPrint(this t.0 )
+ t.0 = t.0
+ t.2 = [t.0+0]
+ t.3 = [t.2+32]
+ t.1 = call t.3(t.0 )
+ t.4 = t.1
+ if0 t.4 goto :if342_else
+if342_body:
+ t.7 = [this]
+ t.0 = t.0
+ t.9 = [t.0+0]
+ t.10 = [t.9+16]
+ t.8 = call t.10(t.0 )
+ t.11 = t.8
+ t.7 = [t.7+76]
+ t.6 = call t.7(this t.11)
+ t.5 = t.6
+ goto :if342_end
+if342_else:
+ t.5 = 1
+if342_end:
+ t.0 = t.0
+ t.13 = [t.0+0]
+ t.14 = [t.13+20]
+ t.12 = call t.14(t.0 )
+ t.15 = t.12
+ PrintIntS(t.15)
+ t.0 = t.0
+ t.17 = [t.0+0]
+ t.18 = [t.17+28]
+ t.16 = call t.18(t.0 )
+ t.19 = t.16
+ if0 t.19 goto :if356_else
+if356_body:
+ t.21 = [this]
+ t.0 = t.0
+ t.23 = [t.0+0]
+ t.24 = [t.23+12]
+ t.22 = call t.24(t.0 )
+ t.25 = t.22
+ t.21 = [t.21+76]
+ t.20 = call t.21(this t.25)
+ t.5 = t.20
+ goto :if356_end
+if356_else:
+ t.5 = 1
+if356_end:
+ t.26 = 1
+ ret t.26
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/BinaryTree.vaporm b/output/BinaryTree.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/BinaryTree.vaporm
diff --git a/output/BubbleSort.java b/output/BubbleSort.java
new file mode 100644
index 0000000..e5645a9
--- /dev/null
+++ b/output/BubbleSort.java
@@ -0,0 +1,93 @@
+class BubbleSort{
+ public static void main(String[] a){
+ System.out.println(new BBS().Start(10));
+ }
+}
+
+
+// This class contains the array of integers and
+// methods to initialize, print and sort the array
+// using Bublesort
+class BBS{
+
+ int[] number ;
+ int size ;
+
+ // Invoke the Initialization, Sort and Printing
+ // Methods
+ public int Start(int sz){
+ int aux01 ;
+ aux01 = this.Init(sz);
+ aux01 = this.Print();
+ System.out.println(99999);
+ aux01 = this.Sort();
+ aux01 = this.Print();
+ return 0 ;
+ }
+
+
+ // Sort array of integers using Bublesort method
+ public int Sort(){
+ int nt ;
+ int i ;
+ int aux02 ;
+ int aux04 ;
+ int aux05 ;
+ int aux06 ;
+ int aux07 ;
+ int j ;
+ int t ;
+ i = size - 1 ;
+ aux02 = 0 - 1 ;
+ while (aux02 < i) {
+ j = 1 ;
+ //aux03 = i+1 ;
+ while (j < (i+1)){
+ aux07 = j - 1 ;
+ aux04 = number[aux07] ;
+ aux05 = number[j] ;
+ if (aux05 < aux04) {
+ aux06 = j - 1 ;
+ t = number[aux06] ;
+ number[aux06] = number[j] ;
+ number[j] = t;
+ }
+ else nt = 0 ;
+ j = j + 1 ;
+ }
+ i = i - 1 ;
+ }
+ return 0 ;
+ }
+
+ // Printing method
+ public int Print(){
+ int j ;
+ j = 0 ;
+ while (j < (size)) {
+ System.out.println(number[j]);
+ j = j + 1 ;
+ }
+ return 0 ;
+ }
+
+ // Initialize array of integers
+ public int Init(int sz){
+ size = sz ;
+ number = new int[sz] ;
+
+ number[0] = 20 ;
+ number[1] = 7 ;
+ number[2] = 12 ;
+ number[3] = 18 ;
+ number[4] = 2 ;
+ number[5] = 11 ;
+ number[6] = 6 ;
+ number[7] = 9 ;
+ number[8] = 19 ;
+ number[9] = 5 ;
+
+ return 0 ;
+ }
+
+}
diff --git a/output/BubbleSort.vapor b/output/BubbleSort.vapor
new file mode 100644
index 0000000..5315afc
--- /dev/null
+++ b/output/BubbleSort.vapor
@@ -0,0 +1,223 @@
+func Main()
+ t.3 = HeapAllocZ(24)
+ [t.3+0] = :functable_BBS
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.7 = 10
+ t.2 = call t.6(t.4 t.7)
+ t.8 = t.2
+ PrintIntS(t.8)
+ ret
+
+const functable_BBS
+ :BBS_Start
+ :BBS_Sort
+ :BBS_Print
+ :BBS_Init
+
+func BBS_Start(this t.0 )
+ t.3 = [this]
+ t.4 = t.0
+ t.3 = [t.3+12]
+ t.2 = call t.3(this t.4)
+ t.1 = t.2
+ t.6 = [this]
+ t.6 = [t.6+8]
+ t.5 = call t.6(this )
+ t.1 = t.5
+ t.7 = 99999
+ PrintIntS(t.7)
+ t.9 = [this]
+ t.9 = [t.9+4]
+ t.8 = call t.9(this )
+ t.1 = t.8
+ t.11 = [this]
+ t.11 = [t.11+8]
+ t.10 = call t.11(this )
+ t.1 = t.10
+ t.12 = 0
+ ret t.12
+
+func BBS_Sort(this )
+ t.2 = [this+20]
+ t.3 = 1
+ t.1 = Sub(t.2 t.3)
+ t.0 = t.1
+ t.6 = 0
+ t.7 = 1
+ t.5 = Sub(t.6 t.7)
+ t.4 = t.5
+while23_test:
+ t.9 = t.4
+ t.10 = t.0
+ t.8 = LtS(t.9 t.10)
+ t.11 = t.8
+ if0 t.11 goto :while23_end
+while23_body:
+ t.12 = 1
+while28_test:
+ t.14 = t.12
+ t.16 = t.0
+ t.17 = 1
+ t.15 = Add(t.16 t.17)
+ t.18 = t.15
+ t.13 = LtS(t.14 t.18)
+ t.19 = t.13
+ if0 t.19 goto :while28_end
+while28_body:
+ t.22 = t.12
+ t.23 = 1
+ t.21 = Sub(t.22 t.23)
+ t.20 = t.21
+ t.26 = [this+16]
+ t.27 = MulS(t.20 4)
+ t.27 = Add(t.27 4)
+ t.27 = Add(t.26 t.27)
+ t.25 = [t.27]
+ t.24 = t.25
+ t.30 = [this+16]
+ t.31 = MulS(t.12 4)
+ t.31 = Add(t.31 4)
+ t.31 = Add(t.30 t.31)
+ t.29 = [t.31]
+ t.28 = t.29
+ t.33 = t.28
+ t.34 = t.24
+ t.32 = LtS(t.33 t.34)
+ t.35 = t.32
+ if0 t.35 goto :if45_else
+if45_body:
+ t.38 = t.12
+ t.39 = 1
+ t.37 = Sub(t.38 t.39)
+ t.36 = t.37
+ t.42 = [this+16]
+ t.43 = MulS(t.36 4)
+ t.43 = Add(t.43 4)
+ t.43 = Add(t.42 t.43)
+ t.41 = [t.43]
+ t.40 = t.41
+ t.44 = [this+16]
+ t.45 = MulS(t.36 4)
+ t.45 = Add(t.45 4)
+ t.45 = Add(t.44 t.45)
+ t.47 = [this+16]
+ t.48 = MulS(t.12 4)
+ t.48 = Add(t.48 4)
+ t.48 = Add(t.47 t.48)
+ t.46 = [t.48]
+ [t.45] = t.46
+ t.49 = [this+16]
+ t.50 = MulS(t.12 4)
+ t.50 = Add(t.50 4)
+ t.50 = Add(t.49 t.50)
+ [t.50] = t.40
+ goto :if45_end
+if45_else:
+ t.51 = 0
+if45_end:
+ t.53 = t.12
+ t.54 = 1
+ t.52 = Add(t.53 t.54)
+ t.12 = t.52
+ goto :while28_test
+while28_end:
+ t.56 = t.0
+ t.57 = 1
+ t.55 = Sub(t.56 t.57)
+ t.0 = t.55
+ goto :while23_test
+while23_end:
+ t.58 = 0
+ ret t.58
+
+func BBS_Print(this )
+ t.0 = 0
+while69_test:
+ t.2 = t.0
+ t.3 = [this+20]
+ t.1 = LtS(t.2 t.3)
+ t.4 = t.1
+ if0 t.4 goto :while69_end
+while69_body:
+ t.6 = [this+16]
+ t.7 = MulS(t.0 4)
+ t.7 = Add(t.7 4)
+ t.7 = Add(t.6 t.7)
+ t.5 = [t.7]
+ t.8 = t.5
+ PrintIntS(t.8)
+ t.10 = t.0
+ t.11 = 1
+ t.9 = Add(t.10 t.11)
+ t.0 = t.9
+ goto :while69_test
+while69_end:
+ t.12 = 0
+ ret t.12
+
+func BBS_Init(this t.0 )
+ [this+20] = t.0
+ t.1 = call :AllocArray(t.0)
+ [this+16] = t.1
+ t.2 = [this+16]
+ t.3 = MulS(0 4)
+ t.3 = Add(t.3 4)
+ t.3 = Add(t.2 t.3)
+ [t.3] = 20
+ t.4 = [this+16]
+ t.5 = MulS(1 4)
+ t.5 = Add(t.5 4)
+ t.5 = Add(t.4 t.5)
+ [t.5] = 7
+ t.6 = [this+16]
+ t.7 = MulS(2 4)
+ t.7 = Add(t.7 4)
+ t.7 = Add(t.6 t.7)
+ [t.7] = 12
+ t.8 = [this+16]
+ t.9 = MulS(3 4)
+ t.9 = Add(t.9 4)
+ t.9 = Add(t.8 t.9)
+ [t.9] = 18
+ t.10 = [this+16]
+ t.11 = MulS(4 4)
+ t.11 = Add(t.11 4)
+ t.11 = Add(t.10 t.11)
+ [t.11] = 2
+ t.12 = [this+16]
+ t.13 = MulS(5 4)
+ t.13 = Add(t.13 4)
+ t.13 = Add(t.12 t.13)
+ [t.13] = 11
+ t.14 = [this+16]
+ t.15 = MulS(6 4)
+ t.15 = Add(t.15 4)
+ t.15 = Add(t.14 t.15)
+ [t.15] = 6
+ t.16 = [this+16]
+ t.17 = MulS(7 4)
+ t.17 = Add(t.17 4)
+ t.17 = Add(t.16 t.17)
+ [t.17] = 9
+ t.18 = [this+16]
+ t.19 = MulS(8 4)
+ t.19 = Add(t.19 4)
+ t.19 = Add(t.18 t.19)
+ [t.19] = 19
+ t.20 = [this+16]
+ t.21 = MulS(9 4)
+ t.21 = Add(t.21 4)
+ t.21 = Add(t.20 t.21)
+ [t.21] = 5
+ t.22 = 0
+ ret t.22
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/BubbleSort.vaporm b/output/BubbleSort.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/BubbleSort.vaporm
diff --git a/output/Factorial.java b/output/Factorial.java
new file mode 100644
index 0000000..d938bb6
--- /dev/null
+++ b/output/Factorial.java
@@ -0,0 +1,16 @@
+class Factorial{
+ public static void main(String[] a){
+ System.out.println(new Fac().ComputeFac(10));
+ }
+}
+
+class Fac {
+ public int ComputeFac(int num){
+ int num_aux ;
+ if (num < 1)
+ num_aux = 1 ;
+ else
+ num_aux = num * (this.ComputeFac(num-1)) ;
+ return num_aux ;
+ }
+}
diff --git a/output/Factorial.vapor b/output/Factorial.vapor
new file mode 100644
index 0000000..713ef06
--- /dev/null
+++ b/output/Factorial.vapor
@@ -0,0 +1,47 @@
+func Main()
+ t.3 = HeapAllocZ(4)
+ [t.3+0] = :functable_Fac
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.7 = 10
+ t.2 = call t.6(t.4 t.7)
+ t.8 = t.2
+ PrintIntS(t.8)
+ ret
+
+const functable_Fac
+ :Fac_ComputeFac
+
+func Fac_ComputeFac(this t.0 )
+ t.2 = t.0
+ t.3 = 1
+ t.1 = LtS(t.2 t.3)
+ t.4 = t.1
+ if0 t.4 goto :if6_else
+if6_body:
+ t.5 = 1
+ goto :if6_end
+if6_else:
+ t.7 = t.0
+ t.9 = [this]
+ t.11 = t.0
+ t.12 = 1
+ t.10 = Sub(t.11 t.12)
+ t.13 = t.10
+ t.9 = [t.9+0]
+ t.8 = call t.9(this t.13)
+ t.14 = t.8
+ t.6 = MulS(t.7 t.14)
+ t.5 = t.6
+if6_end:
+ t.15 = t.5
+ ret t.15
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/Factorial.vaporm b/output/Factorial.vaporm
new file mode 100644
index 0000000..a434ac2
--- /dev/null
+++ b/output/Factorial.vaporm
@@ -0,0 +1,138 @@
+const functable_Fac
+ :Fac_ComputeFac
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(4 )
+ [$s7+0] = :functable_Fac
+ $s6 = $s7
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ $s7 = 10
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ call $s5
+ $s4 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s7 = $s4
+ PrintIntS($s7 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func Fac_ComputeFac [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = $a1
+ $s5 = $s7
+ $s4 = 1
+ $s3 = LtS($s5 $s4 )
+ $s4 = $s3
+ if0 $s4 goto :if6_else
+if6_body:
+ $s4 = 1
+ goto :if6_end
+if6_else:
+ $s3 = $s7
+ $s5 = [$s6+0]
+ $s5 = $s7
+ $s7 = 1
+ $s2 = Sub($s5 $s7 )
+ $s7 = $s2
+ $s5 = [$s5+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ call $s5
+ $s2 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s7 = $s2
+ $s2 = MulS($s3 $s7 )
+ $s4 = $s2
+if6_end:
+ $s2 = $s4
+ $v0 = $s2
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/LinearSearch.java b/output/LinearSearch.java
new file mode 100644
index 0000000..daddd94
--- /dev/null
+++ b/output/LinearSearch.java
@@ -0,0 +1,99 @@
+class LinearSearch{
+ public static void main(String[] a){
+ System.out.println(new LS().Start(10));
+ }
+}
+
+
+// This class contains an array of integers and
+// methods to initialize, print and search the array
+// using Linear Search
+class LS {
+ int[] number ;
+ int size ;
+
+ // Invoke methods to initialize, print and search
+ // for elements on the array
+ public int Start(int sz){
+ int aux01 ;
+ int aux02 ;
+
+ aux01 = this.Init(sz);
+ aux02 = this.Print();
+ System.out.println(9999);
+ System.out.println(this.Search(8));
+ System.out.println(this.Search(12)) ;
+ System.out.println(this.Search(17)) ;
+ System.out.println(this.Search(50)) ;
+ return 55 ;
+ }
+
+ // Print array of integers
+ public int Print(){
+ int j ;
+
+ j = 1 ;
+ while (j < (size)) {
+ System.out.println(number[j]);
+ j = j + 1 ;
+ }
+ return 0 ;
+ }
+
+ // Search for a specific value (num) using
+ // linear search
+ public int Search(int num){
+ int j ;
+ boolean ls01 ;
+ int ifound ;
+ int aux01 ;
+ int aux02 ;
+ int nt ;
+
+ j = 1 ;
+ ls01 = false ;
+ ifound = 0 ;
+
+ //System.out.println(num);
+ while (j < (size)) {
+ aux01 = number[j] ;
+ aux02 = num + 1 ;
+ if (aux01 < num) nt = 0 ;
+ else if (!(aux01 < aux02)) nt = 0 ;
+ else {
+ ls01 = true ;
+ ifound = 1 ;
+ j = size ;
+ }
+ j = j + 1 ;
+ }
+
+ return ifound ;
+ }
+
+
+
+ // initialize array of integers with some
+ // some sequence
+ public int Init(int sz){
+ int j ;
+ int k ;
+ int aux01 ;
+ int aux02 ;
+
+ size = sz ;
+ number = new int[sz] ;
+
+ j = 1 ;
+ k = size + 1 ;
+ while (j < (size)) {
+ aux01 = 2 * j ;
+ aux02 = k - 3 ;
+ number[j] = aux01 + aux02 ;
+ j = j + 1 ;
+ k = k - 1 ;
+ }
+ return 0 ;
+ }
+
+}
diff --git a/output/LinearSearch.vapor b/output/LinearSearch.vapor
new file mode 100644
index 0000000..868e715
--- /dev/null
+++ b/output/LinearSearch.vapor
@@ -0,0 +1,188 @@
+func Main()
+ t.3 = HeapAllocZ(24)
+ [t.3+0] = :functable_LS
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.7 = 10
+ t.2 = call t.6(t.4 t.7)
+ t.8 = t.2
+ PrintIntS(t.8)
+ ret
+
+const functable_LS
+ :LS_Start
+ :LS_Print
+ :LS_Search
+ :LS_Init
+
+func LS_Start(this t.0 )
+ t.3 = [this]
+ t.4 = t.0
+ t.3 = [t.3+12]
+ t.2 = call t.3(this t.4)
+ t.1 = t.2
+ t.7 = [this]
+ t.7 = [t.7+4]
+ t.6 = call t.7(this )
+ t.5 = t.6
+ t.8 = 9999
+ PrintIntS(t.8)
+ t.10 = [this]
+ t.11 = 8
+ t.10 = [t.10+8]
+ t.9 = call t.10(this t.11)
+ t.12 = t.9
+ PrintIntS(t.12)
+ t.14 = [this]
+ t.15 = 12
+ t.14 = [t.14+8]
+ t.13 = call t.14(this t.15)
+ t.16 = t.13
+ PrintIntS(t.16)
+ t.18 = [this]
+ t.19 = 17
+ t.18 = [t.18+8]
+ t.17 = call t.18(this t.19)
+ t.20 = t.17
+ PrintIntS(t.20)
+ t.22 = [this]
+ t.23 = 50
+ t.22 = [t.22+8]
+ t.21 = call t.22(this t.23)
+ t.24 = t.21
+ PrintIntS(t.24)
+ t.25 = 55
+ ret t.25
+
+func LS_Print(this )
+ t.0 = 1
+while29_test:
+ t.2 = t.0
+ t.3 = [this+20]
+ t.1 = LtS(t.2 t.3)
+ t.4 = t.1
+ if0 t.4 goto :while29_end
+while29_body:
+ t.6 = [this+16]
+ t.7 = MulS(t.0 4)
+ t.7 = Add(t.7 4)
+ t.7 = Add(t.6 t.7)
+ t.5 = [t.7]
+ t.8 = t.5
+ PrintIntS(t.8)
+ t.10 = t.0
+ t.11 = 1
+ t.9 = Add(t.10 t.11)
+ t.0 = t.9
+ goto :while29_test
+while29_end:
+ t.12 = 0
+ ret t.12
+
+func LS_Search(this t.0 )
+ t.1 = 1
+ t.2 = 0
+ t.3 = 0
+while42_test:
+ t.5 = t.1
+ t.6 = [this+20]
+ t.4 = LtS(t.5 t.6)
+ t.7 = t.4
+ if0 t.7 goto :while42_end
+while42_body:
+ t.10 = [this+16]
+ t.11 = MulS(t.1 4)
+ t.11 = Add(t.11 4)
+ t.11 = Add(t.10 t.11)
+ t.9 = [t.11]
+ t.8 = t.9
+ t.14 = t.0
+ t.15 = 1
+ t.13 = Add(t.14 t.15)
+ t.12 = t.13
+ t.17 = t.8
+ t.18 = t.0
+ t.16 = LtS(t.17 t.18)
+ t.19 = t.16
+ if0 t.19 goto :if53_else
+if53_body:
+ t.20 = 0
+ goto :if53_end
+if53_else:
+ t.23 = t.8
+ t.24 = t.12
+ t.22 = LtS(t.23 t.24)
+ t.21 = Eq(t.22 0)
+ t.25 = t.21
+ if0 t.25 goto :if57_else
+if57_body:
+ t.20 = 0
+ goto :if57_end
+if57_else:
+ t.2 = 1
+ t.3 = 1
+ t.1 = [this+20]
+if57_end:
+if53_end:
+ t.27 = t.1
+ t.28 = 1
+ t.26 = Add(t.27 t.28)
+ t.1 = t.26
+ goto :while42_test
+while42_end:
+ t.29 = t.3
+ ret t.29
+
+func LS_Init(this t.0 )
+ [this+20] = t.0
+ t.1 = call :AllocArray(t.0)
+ [this+16] = t.1
+ t.2 = 1
+ t.5 = [this+20]
+ t.6 = 1
+ t.4 = Add(t.5 t.6)
+ t.3 = t.4
+while70_test:
+ t.8 = t.2
+ t.9 = [this+20]
+ t.7 = LtS(t.8 t.9)
+ t.10 = t.7
+ if0 t.10 goto :while70_end
+while70_body:
+ t.13 = 2
+ t.14 = t.2
+ t.12 = MulS(t.13 t.14)
+ t.11 = t.12
+ t.17 = t.3
+ t.18 = 3
+ t.16 = Sub(t.17 t.18)
+ t.15 = t.16
+ t.19 = [this+16]
+ t.20 = MulS(t.2 4)
+ t.20 = Add(t.20 4)
+ t.20 = Add(t.19 t.20)
+ t.22 = t.11
+ t.23 = t.15
+ t.21 = Add(t.22 t.23)
+ [t.20] = t.21
+ t.25 = t.2
+ t.26 = 1
+ t.24 = Add(t.25 t.26)
+ t.2 = t.24
+ t.28 = t.3
+ t.29 = 1
+ t.27 = Sub(t.28 t.29)
+ t.3 = t.27
+ goto :while70_test
+while70_end:
+ t.30 = 0
+ ret t.30
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/LinearSearch.vaporm b/output/LinearSearch.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/LinearSearch.vaporm
diff --git a/output/LinkedList.java b/output/LinkedList.java
new file mode 100644
index 0000000..69adc33
--- /dev/null
+++ b/output/LinkedList.java
@@ -0,0 +1,278 @@
+class LinkedList{
+ public static void main(String[] a){
+ System.out.println(new LL().Start());
+ }
+}
+
+class Element {
+ int Age ;
+ int Salary ;
+ boolean Married ;
+
+ // Initialize some class variables
+ public boolean Init(int v_Age, int v_Salary, boolean v_Married){
+ Age = v_Age ;
+ Salary = v_Salary ;
+ Married = v_Married ;
+ return true ;
+ }
+
+ public int GetAge(){
+ return Age ;
+ }
+
+ public int GetSalary(){
+ return Salary ;
+ }
+
+ public boolean GetMarried(){
+ return Married ;
+ }
+
+ // This method returns true if the object "other"
+ // has the same values for age, salary and
+ public boolean Equal(Element other){
+ boolean ret_val ;
+ int aux01 ;
+ int aux02 ;
+ int nt ;
+ ret_val = true ;
+
+ aux01 = other.GetAge();
+ if (!this.Compare(aux01,Age)) ret_val = false ;
+ else {
+ aux02 = other.GetSalary();
+ if (!this.Compare(aux02,Salary)) ret_val = false ;
+ else
+ if (Married)
+ if (!other.GetMarried()) ret_val = false;
+ else nt = 0 ;
+ else
+ if (other.GetMarried()) ret_val = false;
+ else nt = 0 ;
+ }
+
+ return ret_val ;
+ }
+
+ // This method compares two integers and
+ // returns true if they are equal and false
+ // otherwise
+ public boolean Compare(int num1 , int num2){
+ boolean retval ;
+ int aux02 ;
+ retval = false ;
+ aux02 = num2 + 1 ;
+ if (num1 < num2) retval = false ;
+ else if (!(num1 < aux02)) retval = false ;
+ else retval = true ;
+ return retval ;
+ }
+
+}
+
+class List{
+ Element elem ;
+ List next ;
+ boolean end ;
+
+ // Initialize the node list as the last node
+ public boolean Init(){
+ end = true ;
+ return true ;
+ }
+
+ // Initialize the values of a new node
+ public boolean InitNew(Element v_elem, List v_next, boolean v_end){
+ end = v_end ;
+ elem = v_elem ;
+ next = v_next ;
+ return true ;
+ }
+
+ // Insert a new node at the beginning of the list
+ public List Insert(Element new_elem){
+ boolean ret_val ;
+ List aux03 ;
+ List aux02 ;
+ aux03 = this ;
+ aux02 = new List();
+ ret_val = aux02.InitNew(new_elem,aux03,false);
+ return aux02 ;
+ }
+
+
+ // Update the the pointer to the next node
+ public boolean SetNext(List v_next){
+ next = v_next ;
+ return true ;
+ }
+
+ // Delete an element e from the list
+ public List Delete(Element e){
+ List my_head ;
+ boolean ret_val ;
+ boolean aux05;
+ List aux01 ;
+ List prev ;
+ boolean var_end ;
+ Element var_elem ;
+ int aux04 ;
+ int nt ;
+
+
+ my_head = this ;
+ ret_val = false ;
+ aux04 = 0 - 1 ;
+ aux01 = this ;
+ prev = this ;
+ var_end = end;
+ var_elem = elem ;
+ while ((!var_end) && (!ret_val)){
+ if (e.Equal(var_elem)){
+ ret_val = true ;
+ if (aux04 < 0) {
+ // delete first element
+ my_head = aux01.GetNext() ;
+ }
+ else{ // delete a non first element
+ System.out.println(0-555);
+ aux05 = prev.SetNext(aux01.GetNext());
+ System.out.println(0-555);
+
+ }
+ } else nt = 0 ;
+ if (!ret_val){
+ prev = aux01 ;
+ aux01 = aux01.GetNext() ;
+ var_end = aux01.GetEnd();
+ var_elem = aux01.GetElem();
+ aux04 = 1 ;
+ } else nt = 0 ;
+ }
+ return my_head ;
+ }
+
+
+ // Search for an element e on the list
+ public int Search(Element e){
+ int int_ret_val ;
+ List aux01 ;
+ Element var_elem ;
+ boolean var_end ;
+ int nt ;
+
+ int_ret_val = 0 ;
+ aux01 = this ;
+ var_end = end;
+ var_elem = elem ;
+ while (!var_end){
+ if (e.Equal(var_elem)){
+ int_ret_val = 1 ;
+ }
+ else nt = 0 ;
+ aux01 = aux01.GetNext() ;
+ var_end = aux01.GetEnd();
+ var_elem = aux01.GetElem();
+ }
+ return int_ret_val ;
+ }
+
+ public boolean GetEnd(){
+ return end ;
+ }
+
+ public Element GetElem(){
+ return elem ;
+ }
+
+ public List GetNext(){
+ return next ;
+ }
+
+
+ // Print the linked list
+ public boolean Print(){
+ List aux01 ;
+ boolean var_end ;
+ Element var_elem ;
+
+ aux01 = this ;
+ var_end = end ;
+ var_elem = elem ;
+ while (!var_end){
+ System.out.println(var_elem.GetAge());
+ aux01 = aux01.GetNext() ;
+ var_end = aux01.GetEnd();
+ var_elem = aux01.GetElem();
+ }
+
+ return true ;
+ }
+}
+
+
+// this class invokes the methods to insert, delete,
+// search and print the linked list
+class LL{
+
+ public int Start(){
+
+ List head ;
+ List last_elem ;
+ boolean aux01 ;
+ Element el01 ;
+ Element el02 ;
+ Element el03 ;
+
+ last_elem = new List();
+ aux01 = last_elem.Init();
+ head = last_elem ;
+ aux01 = head.Init();
+ aux01 = head.Print();
+
+ // inserting first element
+ el01 = new Element();
+ aux01 = el01.Init(25,37000,false);
+ head = head.Insert(el01);
+ aux01 = head.Print();
+ System.out.println(10000000);
+ // inserting second element
+ el01 = new Element();
+ aux01 = el01.Init(39,42000,true);
+ el02 = el01 ;
+ head = head.Insert(el01);
+ aux01 = head.Print();
+ System.out.println(10000000);
+ // inserting third element
+ el01 = new Element();
+ aux01 = el01.Init(22,34000,false);
+ head = head.Insert(el01);
+ aux01 = head.Print();
+ el03 = new Element();
+ aux01 = el03.Init(27,34000,false);
+ System.out.println(head.Search(el02));
+ System.out.println(head.Search(el03));
+ System.out.println(10000000);
+ // inserting fourth element
+ el01 = new Element();
+ aux01 = el01.Init(28,35000,false);
+ head = head.Insert(el01);
+ aux01 = head.Print();
+ System.out.println(2220000);
+
+ head = head.Delete(el02);
+ aux01 = head.Print();
+ System.out.println(33300000);
+
+
+ head = head.Delete(el01);
+ aux01 = head.Print();
+ System.out.println(44440000);
+
+ return 0 ;
+
+
+ }
+
+}
diff --git a/output/LinkedList.vapor b/output/LinkedList.vapor
new file mode 100644
index 0000000..6a04bc4
--- /dev/null
+++ b/output/LinkedList.vapor
@@ -0,0 +1,556 @@
+func Main()
+ t.3 = HeapAllocZ(4)
+ [t.3+0] = :functable_LL
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.2 = call t.6(t.4 )
+ t.7 = t.2
+ PrintIntS(t.7)
+ ret
+
+const functable_Element
+ :Element_Init
+ :Element_GetAge
+ :Element_GetSalary
+ :Element_GetMarried
+ :Element_Equal
+ :Element_Compare
+
+func Element_Init(this t.0 t.1 t.2 )
+ [this+24] = t.0
+ [this+28] = t.1
+ [this+32] = t.2
+ t.3 = 1
+ ret t.3
+
+func Element_GetAge(this )
+ t.0 = [this+24]
+ ret t.0
+
+func Element_GetSalary(this )
+ t.0 = [this+28]
+ ret t.0
+
+func Element_GetMarried(this )
+ t.0 = [this+32]
+ ret t.0
+
+func Element_Equal(this t.0 )
+ t.1 = 1
+ t.0 = t.0
+ t.4 = [t.0+0]
+ t.5 = [t.4+4]
+ t.3 = call t.5(t.0 )
+ t.2 = t.3
+ t.8 = [this]
+ t.9 = t.2
+ t.10 = [this+24]
+ t.8 = [t.8+20]
+ t.7 = call t.8(this t.9 t.10)
+ t.6 = Eq(t.7 0)
+ t.11 = t.6
+ if0 t.11 goto :if12_else
+if12_body:
+ t.1 = 0
+ goto :if12_end
+if12_else:
+ t.0 = t.0
+ t.14 = [t.0+0]
+ t.15 = [t.14+8]
+ t.13 = call t.15(t.0 )
+ t.12 = t.13
+ t.18 = [this]
+ t.19 = t.12
+ t.20 = [this+28]
+ t.18 = [t.18+20]
+ t.17 = call t.18(this t.19 t.20)
+ t.16 = Eq(t.17 0)
+ t.21 = t.16
+ if0 t.21 goto :if21_else
+if21_body:
+ t.1 = 0
+ goto :if21_end
+if21_else:
+ t.22 = [this+32]
+ if0 t.22 goto :if27_else
+if27_body:
+ t.0 = t.0
+ t.25 = [t.0+0]
+ t.26 = [t.25+12]
+ t.24 = call t.26(t.0 )
+ t.23 = Eq(t.24 0)
+ t.27 = t.23
+ if0 t.27 goto :if28_else
+if28_body:
+ t.1 = 0
+ goto :if28_end
+if28_else:
+ t.28 = 0
+if28_end:
+ goto :if27_end
+if27_else:
+ t.0 = t.0
+ t.30 = [t.0+0]
+ t.31 = [t.30+12]
+ t.29 = call t.31(t.0 )
+ t.32 = t.29
+ if0 t.32 goto :if33_else
+if33_body:
+ t.1 = 0
+ goto :if33_end
+if33_else:
+ t.28 = 0
+if33_end:
+if27_end:
+if21_end:
+if12_end:
+ t.33 = t.1
+ ret t.33
+
+func Element_Compare(this t.0 t.1 )
+ t.2 = 0
+ t.5 = t.1
+ t.6 = 1
+ t.4 = Add(t.5 t.6)
+ t.3 = t.4
+ t.8 = t.0
+ t.9 = t.1
+ t.7 = LtS(t.8 t.9)
+ t.10 = t.7
+ if0 t.10 goto :if41_else
+if41_body:
+ t.2 = 0
+ goto :if41_end
+if41_else:
+ t.13 = t.0
+ t.14 = t.3
+ t.12 = LtS(t.13 t.14)
+ t.11 = Eq(t.12 0)
+ t.15 = t.11
+ if0 t.15 goto :if45_else
+if45_body:
+ t.2 = 0
+ goto :if45_end
+if45_else:
+ t.2 = 1
+if45_end:
+if41_end:
+ t.16 = t.2
+ ret t.16
+
+const functable_List
+ :List_Init
+ :List_InitNew
+ :List_Insert
+ :List_SetNext
+ :List_Delete
+ :List_Search
+ :List_GetEnd
+ :List_GetElem
+ :List_GetNext
+ :List_Print
+
+func List_Init(this )
+ [this+48] = 1
+ t.0 = 1
+ ret t.0
+
+func List_InitNew(this t.0 t.1 t.2 )
+ [this+48] = t.2
+ [this+40] = t.0
+ [this+44] = t.1
+ t.3 = 1
+ ret t.3
+
+func List_Insert(this t.0 )
+ t.2 = this
+ t.4 = HeapAllocZ(52)
+ [t.4+0] = :functable_List
+ t.3 = t.4
+ t.3 = t.3
+ t.7 = [t.3+0]
+ t.8 = [t.7+4]
+ t.9 = t.0
+ t.10 = t.2
+ t.11 = 0
+ t.6 = call t.8(t.3 t.9 t.10 t.11)
+ t.5 = t.6
+ t.12 = t.3
+ ret t.12
+
+func List_SetNext(this t.0 )
+ [this+44] = t.0
+ t.1 = 1
+ ret t.1
+
+func List_Delete(this t.0 )
+ t.3 = this
+ t.4 = 0
+ t.7 = 0
+ t.8 = 1
+ t.6 = Sub(t.7 t.8)
+ t.5 = t.6
+ t.9 = this
+ t.10 = this
+ t.11 = [this+48]
+ t.12 = [this+40]
+while65_test:
+ t.14 = Eq(t.11 0)
+ t.15 = t.14
+ t.16 = Eq(t.4 0)
+ t.17 = t.16
+ t.18 = Eq(1 t.15)
+ t.19 = Eq(1 t.17)
+ t.13 = Eq(t.18 t.19)
+ t.20 = t.13
+ if0 t.20 goto :while65_end
+while65_body:
+ t.0 = t.0
+ t.22 = [t.0+0]
+ t.23 = [t.22+16]
+ t.24 = t.12
+ t.21 = call t.23(t.0 t.24)
+ t.25 = t.21
+ if0 t.25 goto :if74_else
+if74_body:
+ t.4 = 1
+ t.27 = t.5
+ t.28 = 0
+ t.26 = LtS(t.27 t.28)
+ t.29 = t.26
+ if0 t.29 goto :if79_else
+if79_body:
+ t.9 = t.9
+ t.31 = [t.9+0]
+ t.32 = [t.31+32]
+ t.30 = call t.32(t.9 )
+ t.3 = t.30
+ goto :if79_end
+if79_else:
+ t.34 = 0
+ t.35 = 555
+ t.33 = Sub(t.34 t.35)
+ t.36 = t.33
+ PrintIntS(t.36)
+ t.10 = t.10
+ t.39 = [t.10+0]
+ t.40 = [t.39+12]
+ t.9 = t.9
+ t.42 = [t.9+0]
+ t.43 = [t.42+32]
+ t.41 = call t.43(t.9 )
+ t.44 = t.41
+ t.38 = call t.40(t.10 t.44)
+ t.37 = t.38
+ t.46 = 0
+ t.47 = 555
+ t.45 = Sub(t.46 t.47)
+ t.48 = t.45
+ PrintIntS(t.48)
+if79_end:
+ goto :if74_end
+if74_else:
+ t.49 = 0
+if74_end:
+ t.50 = Eq(t.4 0)
+ t.51 = t.50
+ if0 t.51 goto :if101_else
+if101_body:
+ t.10 = t.9
+ t.9 = t.9
+ t.53 = [t.9+0]
+ t.54 = [t.53+32]
+ t.52 = call t.54(t.9 )
+ t.9 = t.52
+ t.9 = t.9
+ t.56 = [t.9+0]
+ t.57 = [t.56+24]
+ t.55 = call t.57(t.9 )
+ t.11 = t.55
+ t.9 = t.9
+ t.59 = [t.9+0]
+ t.60 = [t.59+28]
+ t.58 = call t.60(t.9 )
+ t.12 = t.58
+ t.5 = 1
+ goto :if101_end
+if101_else:
+ t.49 = 0
+if101_end:
+ goto :while65_test
+while65_end:
+ t.61 = t.3
+ ret t.61
+
+func List_Search(this t.0 )
+ t.3 = 0
+ t.4 = this
+ t.5 = [this+48]
+ t.6 = [this+40]
+while113_test:
+ t.7 = Eq(t.5 0)
+ t.8 = t.7
+ if0 t.8 goto :while113_end
+while113_body:
+ t.0 = t.0
+ t.10 = [t.0+0]
+ t.11 = [t.10+16]
+ t.12 = t.6
+ t.9 = call t.11(t.0 t.12)
+ t.13 = t.9
+ if0 t.13 goto :if116_else
+if116_body:
+ t.3 = 1
+ goto :if116_end
+if116_else:
+ t.14 = 0
+if116_end:
+ t.4 = t.4
+ t.16 = [t.4+0]
+ t.17 = [t.16+32]
+ t.15 = call t.17(t.4 )
+ t.4 = t.15
+ t.4 = t.4
+ t.19 = [t.4+0]
+ t.20 = [t.19+24]
+ t.18 = call t.20(t.4 )
+ t.5 = t.18
+ t.4 = t.4
+ t.22 = [t.4+0]
+ t.23 = [t.22+28]
+ t.21 = call t.23(t.4 )
+ t.6 = t.21
+ goto :while113_test
+while113_end:
+ t.24 = t.3
+ ret t.24
+
+func List_GetEnd(this )
+ t.0 = [this+48]
+ ret t.0
+
+func List_GetElem(this )
+ t.0 = [this+40]
+ ret t.0
+
+func List_GetNext(this )
+ t.0 = [this+44]
+ ret t.0
+
+func List_Print(this )
+ t.2 = this
+ t.3 = [this+48]
+ t.4 = [this+40]
+while134_test:
+ t.5 = Eq(t.3 0)
+ t.6 = t.5
+ if0 t.6 goto :while134_end
+while134_body:
+ t.4 = t.4
+ t.8 = [t.4+0]
+ t.9 = [t.8+4]
+ t.7 = call t.9(t.4 )
+ t.10 = t.7
+ PrintIntS(t.10)
+ t.2 = t.2
+ t.12 = [t.2+0]
+ t.13 = [t.12+32]
+ t.11 = call t.13(t.2 )
+ t.2 = t.11
+ t.2 = t.2
+ t.15 = [t.2+0]
+ t.16 = [t.15+24]
+ t.14 = call t.16(t.2 )
+ t.3 = t.14
+ t.2 = t.2
+ t.18 = [t.2+0]
+ t.19 = [t.18+28]
+ t.17 = call t.19(t.2 )
+ t.4 = t.17
+ goto :while134_test
+while134_end:
+ t.20 = 1
+ ret t.20
+
+const functable_LL
+ :LL_Start
+
+func LL_Start(this )
+ t.3 = HeapAllocZ(52)
+ [t.3+0] = :functable_List
+ t.2 = t.3
+ t.2 = t.2
+ t.6 = [t.2+0]
+ t.7 = [t.6+0]
+ t.5 = call t.7(t.2 )
+ t.4 = t.5
+ t.8 = t.2
+ t.8 = t.8
+ t.10 = [t.8+0]
+ t.11 = [t.10+0]
+ t.9 = call t.11(t.8 )
+ t.4 = t.9
+ t.8 = t.8
+ t.13 = [t.8+0]
+ t.14 = [t.13+36]
+ t.12 = call t.14(t.8 )
+ t.4 = t.12
+ t.16 = HeapAllocZ(36)
+ [t.16+0] = :functable_Element
+ t.15 = t.16
+ t.15 = t.15
+ t.18 = [t.15+0]
+ t.19 = [t.18+0]
+ t.20 = 25
+ t.21 = 37000
+ t.22 = 0
+ t.17 = call t.19(t.15 t.20 t.21 t.22)
+ t.4 = t.17
+ t.8 = t.8
+ t.24 = [t.8+0]
+ t.25 = [t.24+8]
+ t.26 = t.15
+ t.23 = call t.25(t.8 t.26)
+ t.8 = t.23
+ t.8 = t.8
+ t.28 = [t.8+0]
+ t.29 = [t.28+36]
+ t.27 = call t.29(t.8 )
+ t.4 = t.27
+ t.30 = 10000000
+ PrintIntS(t.30)
+ t.31 = HeapAllocZ(36)
+ [t.31+0] = :functable_Element
+ t.15 = t.31
+ t.15 = t.15
+ t.33 = [t.15+0]
+ t.34 = [t.33+0]
+ t.35 = 39
+ t.36 = 42000
+ t.37 = 1
+ t.32 = call t.34(t.15 t.35 t.36 t.37)
+ t.4 = t.32
+ t.38 = t.15
+ t.8 = t.8
+ t.40 = [t.8+0]
+ t.41 = [t.40+8]
+ t.42 = t.15
+ t.39 = call t.41(t.8 t.42)
+ t.8 = t.39
+ t.8 = t.8
+ t.44 = [t.8+0]
+ t.45 = [t.44+36]
+ t.43 = call t.45(t.8 )
+ t.4 = t.43
+ t.46 = 10000000
+ PrintIntS(t.46)
+ t.47 = HeapAllocZ(36)
+ [t.47+0] = :functable_Element
+ t.15 = t.47
+ t.15 = t.15
+ t.49 = [t.15+0]
+ t.50 = [t.49+0]
+ t.51 = 22
+ t.52 = 34000
+ t.53 = 0
+ t.48 = call t.50(t.15 t.51 t.52 t.53)
+ t.4 = t.48
+ t.8 = t.8
+ t.55 = [t.8+0]
+ t.56 = [t.55+8]
+ t.57 = t.15
+ t.54 = call t.56(t.8 t.57)
+ t.8 = t.54
+ t.8 = t.8
+ t.59 = [t.8+0]
+ t.60 = [t.59+36]
+ t.58 = call t.60(t.8 )
+ t.4 = t.58
+ t.62 = HeapAllocZ(36)
+ [t.62+0] = :functable_Element
+ t.61 = t.62
+ t.61 = t.61
+ t.64 = [t.61+0]
+ t.65 = [t.64+0]
+ t.66 = 27
+ t.67 = 34000
+ t.68 = 0
+ t.63 = call t.65(t.61 t.66 t.67 t.68)
+ t.4 = t.63
+ t.8 = t.8
+ t.70 = [t.8+0]
+ t.71 = [t.70+20]
+ t.72 = t.38
+ t.69 = call t.71(t.8 t.72)
+ t.73 = t.69
+ PrintIntS(t.73)
+ t.8 = t.8
+ t.75 = [t.8+0]
+ t.76 = [t.75+20]
+ t.77 = t.61
+ t.74 = call t.76(t.8 t.77)
+ t.78 = t.74
+ PrintIntS(t.78)
+ t.79 = 10000000
+ PrintIntS(t.79)
+ t.80 = HeapAllocZ(36)
+ [t.80+0] = :functable_Element
+ t.15 = t.80
+ t.15 = t.15
+ t.82 = [t.15+0]
+ t.83 = [t.82+0]
+ t.84 = 28
+ t.85 = 35000
+ t.86 = 0
+ t.81 = call t.83(t.15 t.84 t.85 t.86)
+ t.4 = t.81
+ t.8 = t.8
+ t.88 = [t.8+0]
+ t.89 = [t.88+8]
+ t.90 = t.15
+ t.87 = call t.89(t.8 t.90)
+ t.8 = t.87
+ t.8 = t.8
+ t.92 = [t.8+0]
+ t.93 = [t.92+36]
+ t.91 = call t.93(t.8 )
+ t.4 = t.91
+ t.94 = 2220000
+ PrintIntS(t.94)
+ t.8 = t.8
+ t.96 = [t.8+0]
+ t.97 = [t.96+16]
+ t.98 = t.38
+ t.95 = call t.97(t.8 t.98)
+ t.8 = t.95
+ t.8 = t.8
+ t.100 = [t.8+0]
+ t.101 = [t.100+36]
+ t.99 = call t.101(t.8 )
+ t.4 = t.99
+ t.102 = 33300000
+ PrintIntS(t.102)
+ t.8 = t.8
+ t.104 = [t.8+0]
+ t.105 = [t.104+16]
+ t.106 = t.15
+ t.103 = call t.105(t.8 t.106)
+ t.8 = t.103
+ t.8 = t.8
+ t.108 = [t.8+0]
+ t.109 = [t.108+36]
+ t.107 = call t.109(t.8 )
+ t.4 = t.107
+ t.110 = 44440000
+ PrintIntS(t.110)
+ t.111 = 0
+ ret t.111
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/LinkedList.vaporm b/output/LinkedList.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/LinkedList.vaporm
diff --git a/output/MoreThan4.java b/output/MoreThan4.java
new file mode 100644
index 0000000..4960f01
--- /dev/null
+++ b/output/MoreThan4.java
@@ -0,0 +1,29 @@
+class MoreThan4{
+ public static void main(String[] a){
+ System.out.println(new MT4().Start(1,2,3,4,5,6));
+ }
+}
+
+class MT4 {
+ public int Start(int p1, int p2, int p3 , int p4, int p5, int p6){
+ int aux ;
+ System.out.println(p1);
+ System.out.println(p2);
+ System.out.println(p3);
+ System.out.println(p4);
+ System.out.println(p5);
+ System.out.println(p6);
+ aux = this.Change(p6,p5,p4,p3,p2,p1);
+ return aux ;
+ }
+
+ public int Change(int p1, int p2, int p3 , int p4, int p5, int p6){
+ System.out.println(p1);
+ System.out.println(p2);
+ System.out.println(p3);
+ System.out.println(p4);
+ System.out.println(p5);
+ System.out.println(p6);
+ return 0 ;
+ }
+}
diff --git a/output/MoreThan4.vapor b/output/MoreThan4.vapor
new file mode 100644
index 0000000..fc09ab1
--- /dev/null
+++ b/output/MoreThan4.vapor
@@ -0,0 +1,70 @@
+func Main()
+ t.3 = HeapAllocZ(8)
+ [t.3+0] = :functable_MT4
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.7 = 1
+ t.8 = 2
+ t.9 = 3
+ t.10 = 4
+ t.11 = 5
+ t.12 = 6
+ t.2 = call t.6(t.4 t.7 t.8 t.9 t.10 t.11 t.12)
+ t.13 = t.2
+ PrintIntS(t.13)
+ ret
+
+const functable_MT4
+ :MT4_Start
+ :MT4_Change
+
+func MT4_Start(this t.0 t.1 t.2 t.3 t.4 t.5 )
+ t.6 = t.0
+ PrintIntS(t.6)
+ t.7 = t.1
+ PrintIntS(t.7)
+ t.8 = t.2
+ PrintIntS(t.8)
+ t.9 = t.3
+ PrintIntS(t.9)
+ t.10 = t.4
+ PrintIntS(t.10)
+ t.11 = t.5
+ PrintIntS(t.11)
+ t.14 = [this]
+ t.15 = t.5
+ t.16 = t.4
+ t.17 = t.3
+ t.18 = t.2
+ t.19 = t.1
+ t.20 = t.0
+ t.14 = [t.14+4]
+ t.13 = call t.14(this t.15 t.16 t.17 t.18 t.19 t.20)
+ t.12 = t.13
+ t.21 = t.12
+ ret t.21
+
+func MT4_Change(this t.0 t.1 t.2 t.3 t.4 t.5 )
+ t.6 = t.0
+ PrintIntS(t.6)
+ t.7 = t.1
+ PrintIntS(t.7)
+ t.8 = t.2
+ PrintIntS(t.8)
+ t.9 = t.3
+ PrintIntS(t.9)
+ t.10 = t.4
+ PrintIntS(t.10)
+ t.11 = t.5
+ PrintIntS(t.11)
+ t.12 = 0
+ ret t.12
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/MoreThan4.vaporm b/output/MoreThan4.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/MoreThan4.vaporm
diff --git a/output/QuickSort.java b/output/QuickSort.java
new file mode 100644
index 0000000..5893390
--- /dev/null
+++ b/output/QuickSort.java
@@ -0,0 +1,112 @@
+class QuickSort{
+ public static void main(String[] a){
+ System.out.println(new QS().Start(10));
+ }
+}
+
+
+// This class contains the array of integers and
+// methods to initialize, print and sort the array
+// using Quicksort
+class QS{
+
+ int[] number ;
+ int size ;
+
+ // Invoke the Initialization, Sort and Printing
+ // Methods
+ public int Start(int sz){
+ int aux01 ;
+ aux01 = this.Init(sz);
+ aux01 = this.Print();
+ System.out.println(9999);
+ aux01 = size - 1 ;
+ aux01 = this.Sort(0,aux01);
+ aux01 = this.Print();
+ return 0 ;
+ }
+
+
+ // Sort array of integers using Quicksort method
+ public int Sort(int left, int right){
+ int v ;
+ int i ;
+ int j ;
+ int nt;
+ int t ;
+ boolean cont01;
+ boolean cont02;
+ int aux03 ;
+ t = 0 ;
+ if (left < right){
+ v = number[right] ;
+ i = left - 1 ;
+ j = right ;
+ cont01 = true ;
+ while (cont01){
+ cont02 = true ;
+ while (cont02){
+ i = i + 1 ;
+ aux03 = number[i] ;
+ if (!(aux03<v)) cont02 = false ;
+ else cont02 = true ;
+ }
+ cont02 = true ;
+ while (cont02){
+ j = j - 1 ;
+ aux03 = number[j] ;
+ if (!(v < aux03)) cont02 = false ;
+ else cont02 = true ;
+ }
+
+
+ t = number[i] ;
+ number[i] = number[j] ;
+ number[j] = t ;
+ //aux03 = i + 1 ;
+ if ( j < (i+1)) cont01 = false ;
+ else cont01 = true ;
+ }
+ number[j] = number[i] ;
+ number[i] = number[right] ;
+ number[right] = t ;
+ nt = this.Sort(left,i-1);
+ nt = this.Sort(i+1,right);
+ }
+ else nt = 0 ;
+ return 0 ;
+ }
+
+
+ // Print array of integers
+ public int Print(){
+ int j ;
+ j = 0 ;
+ while (j < (size)) {
+ System.out.println(number[j]);
+ j = j + 1 ;
+ }
+ return 0 ;
+ }
+
+
+ // Initialize array of integers
+ public int Init(int sz){
+ size = sz ;
+ number = new int[sz] ;
+
+ number[0] = 20 ;
+ number[1] = 7 ;
+ number[2] = 12 ;
+ number[3] = 18 ;
+ number[4] = 2 ;
+ number[5] = 11 ;
+ number[6] = 6 ;
+ number[7] = 9 ;
+ number[8] = 19 ;
+ number[9] = 5 ;
+
+ return 0 ;
+ }
+
+}
diff --git a/output/QuickSort.vapor b/output/QuickSort.vapor
new file mode 100644
index 0000000..57389d6
--- /dev/null
+++ b/output/QuickSort.vapor
@@ -0,0 +1,305 @@
+func Main()
+ t.3 = HeapAllocZ(24)
+ [t.3+0] = :functable_QS
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.7 = 10
+ t.2 = call t.6(t.4 t.7)
+ t.8 = t.2
+ PrintIntS(t.8)
+ ret
+
+const functable_QS
+ :QS_Start
+ :QS_Sort
+ :QS_Print
+ :QS_Init
+
+func QS_Start(this t.0 )
+ t.3 = [this]
+ t.4 = t.0
+ t.3 = [t.3+12]
+ t.2 = call t.3(this t.4)
+ t.1 = t.2
+ t.6 = [this]
+ t.6 = [t.6+8]
+ t.5 = call t.6(this )
+ t.1 = t.5
+ t.7 = 9999
+ PrintIntS(t.7)
+ t.9 = [this+20]
+ t.10 = 1
+ t.8 = Sub(t.9 t.10)
+ t.1 = t.8
+ t.12 = [this]
+ t.13 = 0
+ t.14 = t.1
+ t.12 = [t.12+4]
+ t.11 = call t.12(this t.13 t.14)
+ t.1 = t.11
+ t.16 = [this]
+ t.16 = [t.16+8]
+ t.15 = call t.16(this )
+ t.1 = t.15
+ t.17 = 0
+ ret t.17
+
+func QS_Sort(this t.0 t.1 )
+ t.2 = 0
+ t.4 = t.0
+ t.5 = t.1
+ t.3 = LtS(t.4 t.5)
+ t.6 = t.3
+ if0 t.6 goto :if22_else
+if22_body:
+ t.9 = [this+16]
+ t.10 = MulS(t.1 4)
+ t.10 = Add(t.10 4)
+ t.10 = Add(t.9 t.10)
+ t.8 = [t.10]
+ t.7 = t.8
+ t.13 = t.0
+ t.14 = 1
+ t.12 = Sub(t.13 t.14)
+ t.11 = t.12
+ t.15 = t.1
+ t.16 = 1
+while32_test:
+ t.17 = t.16
+ if0 t.17 goto :while32_end
+while32_body:
+ t.18 = 1
+while34_test:
+ t.19 = t.18
+ if0 t.19 goto :while34_end
+while34_body:
+ t.21 = t.11
+ t.22 = 1
+ t.20 = Add(t.21 t.22)
+ t.11 = t.20
+ t.25 = [this+16]
+ t.26 = MulS(t.11 4)
+ t.26 = Add(t.26 4)
+ t.26 = Add(t.25 t.26)
+ t.24 = [t.26]
+ t.23 = t.24
+ t.29 = t.23
+ t.30 = t.7
+ t.28 = LtS(t.29 t.30)
+ t.27 = Eq(t.28 0)
+ t.31 = t.27
+ if0 t.31 goto :if42_else
+if42_body:
+ t.18 = 0
+ goto :if42_end
+if42_else:
+ t.18 = 1
+if42_end:
+ goto :while34_test
+while34_end:
+ t.18 = 1
+while47_test:
+ t.32 = t.18
+ if0 t.32 goto :while47_end
+while47_body:
+ t.34 = t.15
+ t.35 = 1
+ t.33 = Sub(t.34 t.35)
+ t.15 = t.33
+ t.37 = [this+16]
+ t.38 = MulS(t.15 4)
+ t.38 = Add(t.38 4)
+ t.38 = Add(t.37 t.38)
+ t.36 = [t.38]
+ t.23 = t.36
+ t.41 = t.7
+ t.42 = t.23
+ t.40 = LtS(t.41 t.42)
+ t.39 = Eq(t.40 0)
+ t.43 = t.39
+ if0 t.43 goto :if55_else
+if55_body:
+ t.18 = 0
+ goto :if55_end
+if55_else:
+ t.18 = 1
+if55_end:
+ goto :while47_test
+while47_end:
+ t.45 = [this+16]
+ t.46 = MulS(t.11 4)
+ t.46 = Add(t.46 4)
+ t.46 = Add(t.45 t.46)
+ t.44 = [t.46]
+ t.2 = t.44
+ t.47 = [this+16]
+ t.48 = MulS(t.11 4)
+ t.48 = Add(t.48 4)
+ t.48 = Add(t.47 t.48)
+ t.50 = [this+16]
+ t.51 = MulS(t.15 4)
+ t.51 = Add(t.51 4)
+ t.51 = Add(t.50 t.51)
+ t.49 = [t.51]
+ [t.48] = t.49
+ t.52 = [this+16]
+ t.53 = MulS(t.15 4)
+ t.53 = Add(t.53 4)
+ t.53 = Add(t.52 t.53)
+ [t.53] = t.2
+ t.55 = t.15
+ t.57 = t.11
+ t.58 = 1
+ t.56 = Add(t.57 t.58)
+ t.59 = t.56
+ t.54 = LtS(t.55 t.59)
+ t.60 = t.54
+ if0 t.60 goto :if70_else
+if70_body:
+ t.16 = 0
+ goto :if70_end
+if70_else:
+ t.16 = 1
+if70_end:
+ goto :while32_test
+while32_end:
+ t.61 = [this+16]
+ t.62 = MulS(t.15 4)
+ t.62 = Add(t.62 4)
+ t.62 = Add(t.61 t.62)
+ t.64 = [this+16]
+ t.65 = MulS(t.11 4)
+ t.65 = Add(t.65 4)
+ t.65 = Add(t.64 t.65)
+ t.63 = [t.65]
+ [t.62] = t.63
+ t.66 = [this+16]
+ t.67 = MulS(t.11 4)
+ t.67 = Add(t.67 4)
+ t.67 = Add(t.66 t.67)
+ t.69 = [this+16]
+ t.70 = MulS(t.1 4)
+ t.70 = Add(t.70 4)
+ t.70 = Add(t.69 t.70)
+ t.68 = [t.70]
+ [t.67] = t.68
+ t.71 = [this+16]
+ t.72 = MulS(t.1 4)
+ t.72 = Add(t.72 4)
+ t.72 = Add(t.71 t.72)
+ [t.72] = t.2
+ t.75 = [this]
+ t.78 = t.11
+ t.79 = 1
+ t.77 = Sub(t.78 t.79)
+ t.76 = t.0
+ t.80 = t.77
+ t.75 = [t.75+4]
+ t.74 = call t.75(this t.79 t.80)
+ t.73 = t.74
+ t.82 = [this]
+ t.84 = t.11
+ t.85 = 1
+ t.83 = Add(t.84 t.85)
+ t.86 = t.83
+ t.87 = t.1
+ t.82 = [t.82+4]
+ t.81 = call t.82(this t.86 t.87)
+ t.73 = t.81
+ goto :if22_end
+if22_else:
+ t.73 = 0
+if22_end:
+ t.88 = 0
+ ret t.88
+
+func QS_Print(this )
+ t.0 = 0
+while104_test:
+ t.2 = t.0
+ t.3 = [this+20]
+ t.1 = LtS(t.2 t.3)
+ t.4 = t.1
+ if0 t.4 goto :while104_end
+while104_body:
+ t.6 = [this+16]
+ t.7 = MulS(t.0 4)
+ t.7 = Add(t.7 4)
+ t.7 = Add(t.6 t.7)
+ t.5 = [t.7]
+ t.8 = t.5
+ PrintIntS(t.8)
+ t.10 = t.0
+ t.11 = 1
+ t.9 = Add(t.10 t.11)
+ t.0 = t.9
+ goto :while104_test
+while104_end:
+ t.12 = 0
+ ret t.12
+
+func QS_Init(this t.0 )
+ [this+20] = t.0
+ t.1 = call :AllocArray(t.0)
+ [this+16] = t.1
+ t.2 = [this+16]
+ t.3 = MulS(0 4)
+ t.3 = Add(t.3 4)
+ t.3 = Add(t.2 t.3)
+ [t.3] = 20
+ t.4 = [this+16]
+ t.5 = MulS(1 4)
+ t.5 = Add(t.5 4)
+ t.5 = Add(t.4 t.5)
+ [t.5] = 7
+ t.6 = [this+16]
+ t.7 = MulS(2 4)
+ t.7 = Add(t.7 4)
+ t.7 = Add(t.6 t.7)
+ [t.7] = 12
+ t.8 = [this+16]
+ t.9 = MulS(3 4)
+ t.9 = Add(t.9 4)
+ t.9 = Add(t.8 t.9)
+ [t.9] = 18
+ t.10 = [this+16]
+ t.11 = MulS(4 4)
+ t.11 = Add(t.11 4)
+ t.11 = Add(t.10 t.11)
+ [t.11] = 2
+ t.12 = [this+16]
+ t.13 = MulS(5 4)
+ t.13 = Add(t.13 4)
+ t.13 = Add(t.12 t.13)
+ [t.13] = 11
+ t.14 = [this+16]
+ t.15 = MulS(6 4)
+ t.15 = Add(t.15 4)
+ t.15 = Add(t.14 t.15)
+ [t.15] = 6
+ t.16 = [this+16]
+ t.17 = MulS(7 4)
+ t.17 = Add(t.17 4)
+ t.17 = Add(t.16 t.17)
+ [t.17] = 9
+ t.18 = [this+16]
+ t.19 = MulS(8 4)
+ t.19 = Add(t.19 4)
+ t.19 = Add(t.18 t.19)
+ [t.19] = 19
+ t.20 = [this+16]
+ t.21 = MulS(9 4)
+ t.21 = Add(t.21 4)
+ t.21 = Add(t.20 t.21)
+ [t.21] = 5
+ t.22 = 0
+ ret t.22
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/QuickSort.vaporm b/output/QuickSort.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/QuickSort.vaporm
diff --git a/output/TreeVisitor.java b/output/TreeVisitor.java
new file mode 100644
index 0000000..8debfe6
--- /dev/null
+++ b/output/TreeVisitor.java
@@ -0,0 +1,374 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/TreeVisitor.vapor b/output/TreeVisitor.vapor
new file mode 100644
index 0000000..8cbc9cc
--- /dev/null
+++ b/output/TreeVisitor.vapor
@@ -0,0 +1,896 @@
+func Main()
+ t.3 = HeapAllocZ(4)
+ [t.3+0] = :functable_TV
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.2 = call t.6(t.4 )
+ t.7 = t.2
+ PrintIntS(t.7)
+ ret
+
+const functable_TV
+ :TV_Start
+
+func TV_Start(this )
+ t.3 = HeapAllocZ(108)
+ [t.3+0] = :functable_Tree
+ t.2 = t.3
+ t.2 = t.2
+ t.6 = [t.2+0]
+ t.7 = [t.6+0]
+ t.8 = 16
+ t.5 = call t.7(t.2 t.8)
+ t.4 = t.5
+ t.2 = t.2
+ t.10 = [t.2+0]
+ t.11 = [t.10+72]
+ t.9 = call t.11(t.2 )
+ t.4 = t.9
+ t.12 = 100000000
+ PrintIntS(t.12)
+ t.2 = t.2
+ t.14 = [t.2+0]
+ t.15 = [t.14+48]
+ t.16 = 8
+ t.13 = call t.15(t.2 t.16)
+ t.4 = t.13
+ t.2 = t.2
+ t.18 = [t.2+0]
+ t.19 = [t.18+48]
+ t.20 = 24
+ t.17 = call t.19(t.2 t.20)
+ t.4 = t.17
+ t.2 = t.2
+ t.22 = [t.2+0]
+ t.23 = [t.22+48]
+ t.24 = 4
+ t.21 = call t.23(t.2 t.24)
+ t.4 = t.21
+ t.2 = t.2
+ t.26 = [t.2+0]
+ t.27 = [t.26+48]
+ t.28 = 12
+ t.25 = call t.27(t.2 t.28)
+ t.4 = t.25
+ t.2 = t.2
+ t.30 = [t.2+0]
+ t.31 = [t.30+48]
+ t.32 = 20
+ t.29 = call t.31(t.2 t.32)
+ t.4 = t.29
+ t.2 = t.2
+ t.34 = [t.2+0]
+ t.35 = [t.34+48]
+ t.36 = 28
+ t.33 = call t.35(t.2 t.36)
+ t.4 = t.33
+ t.2 = t.2
+ t.38 = [t.2+0]
+ t.39 = [t.38+48]
+ t.40 = 14
+ t.37 = call t.39(t.2 t.40)
+ t.4 = t.37
+ t.2 = t.2
+ t.42 = [t.2+0]
+ t.43 = [t.42+72]
+ t.41 = call t.43(t.2 )
+ t.4 = t.41
+ t.44 = 100000000
+ PrintIntS(t.44)
+ t.46 = HeapAllocZ(16)
+ [t.46+0] = :functable_MyVisitor
+ t.45 = t.46
+ t.47 = 50000000
+ PrintIntS(t.47)
+ t.2 = t.2
+ t.50 = [t.2+0]
+ t.51 = [t.50+80]
+ t.52 = t.45
+ t.49 = call t.51(t.2 t.52)
+ t.48 = t.49
+ t.53 = 100000000
+ PrintIntS(t.53)
+ t.2 = t.2
+ t.55 = [t.2+0]
+ t.56 = [t.55+68]
+ t.57 = 24
+ t.54 = call t.56(t.2 t.57)
+ t.58 = t.54
+ PrintIntS(t.58)
+ t.2 = t.2
+ t.60 = [t.2+0]
+ t.61 = [t.60+68]
+ t.62 = 12
+ t.59 = call t.61(t.2 t.62)
+ t.63 = t.59
+ PrintIntS(t.63)
+ t.2 = t.2
+ t.65 = [t.2+0]
+ t.66 = [t.65+68]
+ t.67 = 16
+ t.64 = call t.66(t.2 t.67)
+ t.68 = t.64
+ PrintIntS(t.68)
+ t.2 = t.2
+ t.70 = [t.2+0]
+ t.71 = [t.70+68]
+ t.72 = 50
+ t.69 = call t.71(t.2 t.72)
+ t.73 = t.69
+ PrintIntS(t.73)
+ t.2 = t.2
+ t.75 = [t.2+0]
+ t.76 = [t.75+68]
+ t.77 = 12
+ t.74 = call t.76(t.2 t.77)
+ t.78 = t.74
+ PrintIntS(t.78)
+ t.2 = t.2
+ t.80 = [t.2+0]
+ t.81 = [t.80+52]
+ t.82 = 12
+ t.79 = call t.81(t.2 t.82)
+ t.4 = t.79
+ t.2 = t.2
+ t.84 = [t.2+0]
+ t.85 = [t.84+72]
+ t.83 = call t.85(t.2 )
+ t.4 = t.83
+ t.2 = t.2
+ t.87 = [t.2+0]
+ t.88 = [t.87+68]
+ t.89 = 12
+ t.86 = call t.88(t.2 t.89)
+ t.90 = t.86
+ PrintIntS(t.90)
+ t.91 = 0
+ ret t.91
+
+const functable_Tree
+ :Tree_Init
+ :Tree_SetRight
+ :Tree_SetLeft
+ :Tree_GetRight
+ :Tree_GetLeft
+ :Tree_GetKey
+ :Tree_SetKey
+ :Tree_GetHas_Right
+ :Tree_GetHas_Left
+ :Tree_SetHas_Left
+ :Tree_SetHas_Right
+ :Tree_Compare
+ :Tree_Insert
+ :Tree_Delete
+ :Tree_Remove
+ :Tree_RemoveRight
+ :Tree_RemoveLeft
+ :Tree_Search
+ :Tree_Print
+ :Tree_RecPrint
+ :Tree_accept
+
+func Tree_Init(this t.0 )
+ [this+92] = t.0
+ [this+96] = 0
+ [this+100] = 0
+ t.1 = 1
+ ret t.1
+
+func Tree_SetRight(this t.0 )
+ [this+88] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_SetLeft(this t.0 )
+ [this+84] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_GetRight(this )
+ t.0 = [this+88]
+ ret t.0
+
+func Tree_GetLeft(this )
+ t.0 = [this+84]
+ ret t.0
+
+func Tree_GetKey(this )
+ t.0 = [this+92]
+ ret t.0
+
+func Tree_SetKey(this t.0 )
+ [this+92] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_GetHas_Right(this )
+ t.0 = [this+100]
+ ret t.0
+
+func Tree_GetHas_Left(this )
+ t.0 = [this+96]
+ ret t.0
+
+func Tree_SetHas_Left(this t.0 )
+ [this+96] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_SetHas_Right(this t.0 )
+ [this+100] = t.0
+ t.1 = 1
+ ret t.1
+
+func Tree_Compare(this t.0 t.1 )
+ t.2 = 0
+ t.5 = t.1
+ t.6 = 1
+ t.4 = Add(t.5 t.6)
+ t.3 = t.4
+ t.8 = t.0
+ t.9 = t.1
+ t.7 = LtS(t.8 t.9)
+ t.10 = t.7
+ if0 t.10 goto :if105_else
+if105_body:
+ t.2 = 0
+ goto :if105_end
+if105_else:
+ t.13 = t.0
+ t.14 = t.3
+ t.12 = LtS(t.13 t.14)
+ t.11 = Eq(t.12 0)
+ t.15 = t.11
+ if0 t.15 goto :if109_else
+if109_body:
+ t.2 = 0
+ goto :if109_end
+if109_else:
+ t.2 = 1
+if109_end:
+if105_end:
+ t.16 = t.2
+ ret t.16
+
+func Tree_Insert(this t.0 )
+ t.3 = HeapAllocZ(108)
+ [t.3+0] = :functable_Tree
+ t.2 = t.3
+ t.2 = t.2
+ t.6 = [t.2+0]
+ t.7 = [t.6+0]
+ t.8 = t.0
+ t.5 = call t.7(t.2 t.8)
+ t.4 = t.5
+ t.9 = this
+ t.10 = 1
+while120_test:
+ t.11 = t.10
+ if0 t.11 goto :while120_end
+while120_body:
+ t.9 = t.9
+ t.14 = [t.9+0]
+ t.15 = [t.14+20]
+ t.13 = call t.15(t.9 )
+ t.12 = t.13
+ t.17 = t.0
+ t.18 = t.12
+ t.16 = LtS(t.17 t.18)
+ t.19 = t.16
+ if0 t.19 goto :if125_else
+if125_body:
+ t.9 = t.9
+ t.21 = [t.9+0]
+ t.22 = [t.21+32]
+ t.20 = call t.22(t.9 )
+ t.23 = t.20
+ if0 t.23 goto :if129_else
+if129_body:
+ t.9 = t.9
+ t.25 = [t.9+0]
+ t.26 = [t.25+16]
+ t.24 = call t.26(t.9 )
+ t.9 = t.24
+ goto :if129_end
+if129_else:
+ t.10 = 0
+ t.9 = t.9
+ t.28 = [t.9+0]
+ t.29 = [t.28+36]
+ t.30 = 1
+ t.27 = call t.29(t.9 t.30)
+ t.4 = t.27
+ t.9 = t.9
+ t.32 = [t.9+0]
+ t.33 = [t.32+8]
+ t.34 = t.2
+ t.31 = call t.33(t.9 t.34)
+ t.4 = t.31
+if129_end:
+ goto :if125_end
+if125_else:
+ t.9 = t.9
+ t.36 = [t.9+0]
+ t.37 = [t.36+28]
+ t.35 = call t.37(t.9 )
+ t.38 = t.35
+ if0 t.38 goto :if144_else
+if144_body:
+ t.9 = t.9
+ t.40 = [t.9+0]
+ t.41 = [t.40+12]
+ t.39 = call t.41(t.9 )
+ t.9 = t.39
+ goto :if144_end
+if144_else:
+ t.10 = 0
+ t.9 = t.9
+ t.43 = [t.9+0]
+ t.44 = [t.43+40]
+ t.45 = 1
+ t.42 = call t.44(t.9 t.45)
+ t.4 = t.42
+ t.9 = t.9
+ t.47 = [t.9+0]
+ t.48 = [t.47+4]
+ t.49 = t.2
+ t.46 = call t.48(t.9 t.49)
+ t.4 = t.46
+if144_end:
+if125_end:
+ goto :while120_test
+while120_end:
+ t.50 = 1
+ ret t.50
+
+func Tree_Delete(this t.0 )
+ t.2 = this
+ t.3 = this
+ t.4 = 1
+ t.5 = 0
+ t.6 = 1
+while160_test:
+ t.7 = t.4
+ if0 t.7 goto :while160_end
+while160_body:
+ t.2 = t.2
+ t.10 = [t.2+0]
+ t.11 = [t.10+20]
+ t.9 = call t.11(t.2 )
+ t.8 = t.9
+ t.13 = t.0
+ t.14 = t.8
+ t.12 = LtS(t.13 t.14)
+ t.15 = t.12
+ if0 t.15 goto :if165_else
+if165_body:
+ t.2 = t.2
+ t.17 = [t.2+0]
+ t.18 = [t.17+32]
+ t.16 = call t.18(t.2 )
+ t.19 = t.16
+ if0 t.19 goto :if169_else
+if169_body:
+ t.3 = t.2
+ t.2 = t.2
+ t.21 = [t.2+0]
+ t.22 = [t.21+16]
+ t.20 = call t.22(t.2 )
+ t.2 = t.20
+ goto :if169_end
+if169_else:
+ t.4 = 0
+if169_end:
+ goto :if165_end
+if165_else:
+ t.24 = t.8
+ t.25 = t.0
+ t.23 = LtS(t.24 t.25)
+ t.26 = t.23
+ if0 t.26 goto :if176_else
+if176_body:
+ t.2 = t.2
+ t.28 = [t.2+0]
+ t.29 = [t.28+28]
+ t.27 = call t.29(t.2 )
+ t.30 = t.27
+ if0 t.30 goto :if180_else
+if180_body:
+ t.3 = t.2
+ t.2 = t.2
+ t.32 = [t.2+0]
+ t.33 = [t.32+12]
+ t.31 = call t.33(t.2 )
+ t.2 = t.31
+ goto :if180_end
+if180_else:
+ t.4 = 0
+if180_end:
+ goto :if176_end
+if176_else:
+ t.34 = t.6
+ if0 t.34 goto :if187_else
+if187_body:
+ t.2 = t.2
+ t.38 = [t.2+0]
+ t.39 = [t.38+28]
+ t.37 = call t.39(t.2 )
+ t.36 = Eq(t.37 0)
+ t.40 = t.36
+ t.2 = t.2
+ t.43 = [t.2+0]
+ t.44 = [t.43+32]
+ t.42 = call t.44(t.2 )
+ t.41 = Eq(t.42 0)
+ t.45 = t.41
+ t.46 = Eq(1 t.40)
+ t.47 = Eq(1 t.45)
+ t.35 = Eq(t.46 t.47)
+ t.48 = t.35
+ if0 t.48 goto :if188_else
+if188_body:
+ t.49 = 1
+ goto :if188_end
+if188_else:
+ t.51 = [this]
+ t.52 = t.3
+ t.53 = t.2
+ t.51 = [t.51+56]
+ t.50 = call t.51(this t.52 t.53)
+ t.49 = t.50
+if188_end:
+ goto :if187_end
+if187_else:
+ t.55 = [this]
+ t.56 = t.3
+ t.57 = t.2
+ t.55 = [t.55+56]
+ t.54 = call t.55(this t.56 t.57)
+ t.49 = t.54
+if187_end:
+ t.5 = 1
+ t.4 = 0
+if176_end:
+if165_end:
+ t.6 = 0
+ goto :while160_test
+while160_end:
+ t.58 = t.5
+ ret t.58
+
+func Tree_Remove(this t.0 t.1 )
+ t.1 = t.1
+ t.3 = [t.1+0]
+ t.4 = [t.3+32]
+ t.2 = call t.4(t.1 )
+ t.5 = t.2
+ if0 t.5 goto :if211_else
+if211_body:
+ t.8 = [this]
+ t.9 = t.0
+ t.10 = t.1
+ t.8 = [t.8+64]
+ t.7 = call t.8(this t.9 t.10)
+ t.6 = t.7
+ goto :if211_end
+if211_else:
+ t.1 = t.1
+ t.12 = [t.1+0]
+ t.13 = [t.12+28]
+ t.11 = call t.13(t.1 )
+ t.14 = t.11
+ if0 t.14 goto :if219_else
+if219_body:
+ t.16 = [this]
+ t.17 = t.0
+ t.18 = t.1
+ t.16 = [t.16+60]
+ t.15 = call t.16(this t.17 t.18)
+ t.6 = t.15
+ goto :if219_end
+if219_else:
+ t.1 = t.1
+ t.21 = [t.1+0]
+ t.22 = [t.21+20]
+ t.20 = call t.22(t.1 )
+ t.19 = t.20
+ t.0 = t.0
+ t.26 = [t.0+0]
+ t.27 = [t.26+16]
+ t.25 = call t.27(t.0 )
+ t.28 = t.25
+ t.29 = [t.28+0]
+ t.30 = [t.29+20]
+ t.24 = call t.30(t.28 )
+ t.23 = t.24
+ t.32 = [this]
+ t.33 = t.19
+ t.34 = t.23
+ t.32 = [t.32+44]
+ t.31 = call t.32(this t.33 t.34)
+ t.35 = t.31
+ if0 t.35 goto :if237_else
+if237_body:
+ t.0 = t.0
+ t.37 = [t.0+0]
+ t.38 = [t.37+8]
+ t.39 = [this+104]
+ t.36 = call t.38(t.0 t.39)
+ t.6 = t.36
+ t.0 = t.0
+ t.41 = [t.0+0]
+ t.42 = [t.41+36]
+ t.43 = 0
+ t.40 = call t.42(t.0 t.43)
+ t.6 = t.40
+ goto :if237_end
+if237_else:
+ t.0 = t.0
+ t.45 = [t.0+0]
+ t.46 = [t.45+4]
+ t.47 = [this+104]
+ t.44 = call t.46(t.0 t.47)
+ t.6 = t.44
+ t.0 = t.0
+ t.49 = [t.0+0]
+ t.50 = [t.49+40]
+ t.51 = 0
+ t.48 = call t.50(t.0 t.51)
+ t.6 = t.48
+if237_end:
+if219_end:
+if211_end:
+ t.52 = 1
+ ret t.52
+
+func Tree_RemoveRight(this t.0 t.1 )
+while259_test:
+ t.1 = t.1
+ t.3 = [t.1+0]
+ t.4 = [t.3+28]
+ t.2 = call t.4(t.1 )
+ t.5 = t.2
+ if0 t.5 goto :while259_end
+while259_body:
+ t.1 = t.1
+ t.8 = [t.1+0]
+ t.9 = [t.8+24]
+ t.1 = t.1
+ t.12 = [t.1+0]
+ t.13 = [t.12+12]
+ t.11 = call t.13(t.1 )
+ t.14 = t.11
+ t.15 = [t.14+0]
+ t.16 = [t.15+20]
+ t.10 = call t.16(t.14 )
+ t.17 = t.10
+ t.7 = call t.9(t.1 t.17)
+ t.6 = t.7
+ t.0 = t.1
+ t.1 = t.1
+ t.19 = [t.1+0]
+ t.20 = [t.19+12]
+ t.18 = call t.20(t.1 )
+ t.1 = t.18
+ goto :while259_test
+while259_end:
+ t.0 = t.0
+ t.22 = [t.0+0]
+ t.23 = [t.22+4]
+ t.24 = [this+104]
+ t.21 = call t.23(t.0 t.24)
+ t.6 = t.21
+ t.0 = t.0
+ t.26 = [t.0+0]
+ t.27 = [t.26+40]
+ t.28 = 0
+ t.25 = call t.27(t.0 t.28)
+ t.6 = t.25
+ t.29 = 1
+ ret t.29
+
+func Tree_RemoveLeft(this t.0 t.1 )
+while287_test:
+ t.1 = t.1
+ t.3 = [t.1+0]
+ t.4 = [t.3+32]
+ t.2 = call t.4(t.1 )
+ t.5 = t.2
+ if0 t.5 goto :while287_end
+while287_body:
+ t.1 = t.1
+ t.8 = [t.1+0]
+ t.9 = [t.8+24]
+ t.1 = t.1
+ t.12 = [t.1+0]
+ t.13 = [t.12+16]
+ t.11 = call t.13(t.1 )
+ t.14 = t.11
+ t.15 = [t.14+0]
+ t.16 = [t.15+20]
+ t.10 = call t.16(t.14 )
+ t.17 = t.10
+ t.7 = call t.9(t.1 t.17)
+ t.6 = t.7
+ t.0 = t.1
+ t.1 = t.1
+ t.19 = [t.1+0]
+ t.20 = [t.19+16]
+ t.18 = call t.20(t.1 )
+ t.1 = t.18
+ goto :while287_test
+while287_end:
+ t.0 = t.0
+ t.22 = [t.0+0]
+ t.23 = [t.22+8]
+ t.24 = [this+104]
+ t.21 = call t.23(t.0 t.24)
+ t.6 = t.21
+ t.0 = t.0
+ t.26 = [t.0+0]
+ t.27 = [t.26+36]
+ t.28 = 0
+ t.25 = call t.27(t.0 t.28)
+ t.6 = t.25
+ t.29 = 1
+ ret t.29
+
+func Tree_Search(this t.0 )
+ t.2 = this
+ t.3 = 1
+ t.4 = 0
+while315_test:
+ t.5 = t.3
+ if0 t.5 goto :while315_end
+while315_body:
+ t.2 = t.2
+ t.8 = [t.2+0]
+ t.9 = [t.8+20]
+ t.7 = call t.9(t.2 )
+ t.6 = t.7
+ t.11 = t.0
+ t.12 = t.6
+ t.10 = LtS(t.11 t.12)
+ t.13 = t.10
+ if0 t.13 goto :if320_else
+if320_body:
+ t.2 = t.2
+ t.15 = [t.2+0]
+ t.16 = [t.15+32]
+ t.14 = call t.16(t.2 )
+ t.17 = t.14
+ if0 t.17 goto :if324_else
+if324_body:
+ t.2 = t.2
+ t.19 = [t.2+0]
+ t.20 = [t.19+16]
+ t.18 = call t.20(t.2 )
+ t.2 = t.18
+ goto :if324_end
+if324_else:
+ t.3 = 0
+if324_end:
+ goto :if320_end
+if320_else:
+ t.22 = t.6
+ t.23 = t.0
+ t.21 = LtS(t.22 t.23)
+ t.24 = t.21
+ if0 t.24 goto :if331_else
+if331_body:
+ t.2 = t.2
+ t.26 = [t.2+0]
+ t.27 = [t.26+28]
+ t.25 = call t.27(t.2 )
+ t.28 = t.25
+ if0 t.28 goto :if335_else
+if335_body:
+ t.2 = t.2
+ t.30 = [t.2+0]
+ t.31 = [t.30+12]
+ t.29 = call t.31(t.2 )
+ t.2 = t.29
+ goto :if335_end
+if335_else:
+ t.3 = 0
+if335_end:
+ goto :if331_end
+if331_else:
+ t.4 = 1
+ t.3 = 0
+if331_end:
+if320_end:
+ goto :while315_test
+while315_end:
+ t.32 = t.4
+ ret t.32
+
+func Tree_Print(this )
+ t.1 = this
+ t.4 = [this]
+ t.5 = t.1
+ t.4 = [t.4+76]
+ t.3 = call t.4(this t.5)
+ t.2 = t.3
+ t.6 = 1
+ ret t.6
+
+func Tree_RecPrint(this t.0 )
+ t.0 = t.0
+ t.2 = [t.0+0]
+ t.3 = [t.2+32]
+ t.1 = call t.3(t.0 )
+ t.4 = t.1
+ if0 t.4 goto :if347_else
+if347_body:
+ t.7 = [this]
+ t.0 = t.0
+ t.9 = [t.0+0]
+ t.10 = [t.9+16]
+ t.8 = call t.10(t.0 )
+ t.11 = t.8
+ t.7 = [t.7+76]
+ t.6 = call t.7(this t.11)
+ t.5 = t.6
+ goto :if347_end
+if347_else:
+ t.5 = 1
+if347_end:
+ t.0 = t.0
+ t.13 = [t.0+0]
+ t.14 = [t.13+20]
+ t.12 = call t.14(t.0 )
+ t.15 = t.12
+ PrintIntS(t.15)
+ t.0 = t.0
+ t.17 = [t.0+0]
+ t.18 = [t.17+28]
+ t.16 = call t.18(t.0 )
+ t.19 = t.16
+ if0 t.19 goto :if361_else
+if361_body:
+ t.21 = [this]
+ t.0 = t.0
+ t.23 = [t.0+0]
+ t.24 = [t.23+12]
+ t.22 = call t.24(t.0 )
+ t.25 = t.22
+ t.21 = [t.21+76]
+ t.20 = call t.21(this t.25)
+ t.5 = t.20
+ goto :if361_end
+if361_else:
+ t.5 = 1
+if361_end:
+ t.26 = 1
+ ret t.26
+
+func Tree_accept(this t.0 )
+ t.1 = 333
+ PrintIntS(t.1)
+ t.0 = t.0
+ t.4 = [t.0+0]
+ t.5 = [t.4+0]
+ t.6 = this
+ t.3 = call t.5(t.0 t.6)
+ t.2 = t.3
+ t.7 = 0
+ ret t.7
+
+const functable_Visitor
+ :Visitor_visit
+
+func Visitor_visit(this t.0 )
+ t.0 = t.0
+ t.2 = [t.0+0]
+ t.3 = [t.2+28]
+ t.1 = call t.3(t.0 )
+ t.4 = t.1
+ if0 t.4 goto :if378_else
+if378_body:
+ t.0 = t.0
+ t.6 = [t.0+0]
+ t.7 = [t.6+12]
+ t.5 = call t.7(t.0 )
+ [this+8] = t.5
+ t.10 = [this+8]
+ t.11 = [t.10+0]
+ t.12 = [t.11+80]
+ t.13 = this
+ t.9 = call t.12(t.10 t.13)
+ t.8 = t.9
+ goto :if378_end
+if378_else:
+ t.8 = 0
+if378_end:
+ t.0 = t.0
+ t.15 = [t.0+0]
+ t.16 = [t.15+32]
+ t.14 = call t.16(t.0 )
+ t.17 = t.14
+ if0 t.17 goto :if389_else
+if389_body:
+ t.0 = t.0
+ t.19 = [t.0+0]
+ t.20 = [t.19+16]
+ t.18 = call t.20(t.0 )
+ [this+4] = t.18
+ t.22 = [this+4]
+ t.23 = [t.22+0]
+ t.24 = [t.23+80]
+ t.25 = this
+ t.21 = call t.24(t.22 t.25)
+ t.8 = t.21
+ goto :if389_end
+if389_else:
+ t.8 = 0
+if389_end:
+ t.26 = 0
+ ret t.26
+
+const functable_MyVisitor
+ :MyVisitor_visit
+ :Visitor_visit
+
+func MyVisitor_visit(this t.0 )
+ t.0 = t.0
+ t.2 = [t.0+0]
+ t.3 = [t.2+28]
+ t.1 = call t.3(t.0 )
+ t.4 = t.1
+ if0 t.4 goto :if401_else
+if401_body:
+ t.0 = t.0
+ t.6 = [t.0+0]
+ t.7 = [t.6+12]
+ t.5 = call t.7(t.0 )
+ [this+12] = t.5
+ t.10 = [this+12]
+ t.11 = [t.10+0]
+ t.12 = [t.11+80]
+ t.13 = this
+ t.9 = call t.12(t.10 t.13)
+ t.8 = t.9
+ goto :if401_end
+if401_else:
+ t.8 = 0
+if401_end:
+ t.0 = t.0
+ t.15 = [t.0+0]
+ t.16 = [t.15+20]
+ t.14 = call t.16(t.0 )
+ t.17 = t.14
+ PrintIntS(t.17)
+ t.0 = t.0
+ t.19 = [t.0+0]
+ t.20 = [t.19+32]
+ t.18 = call t.20(t.0 )
+ t.21 = t.18
+ if0 t.21 goto :if416_else
+if416_body:
+ t.0 = t.0
+ t.23 = [t.0+0]
+ t.24 = [t.23+16]
+ t.22 = call t.24(t.0 )
+ [this+8] = t.22
+ t.26 = [this+8]
+ t.27 = [t.26+0]
+ t.28 = [t.27+80]
+ t.29 = this
+ t.25 = call t.28(t.26 t.29)
+ t.8 = t.25
+ goto :if416_end
+if416_else:
+ t.8 = 0
+if416_end:
+ t.30 = 0
+ ret t.30
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/TreeVisitor.vaporm b/output/TreeVisitor.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/TreeVisitor.vaporm
diff --git a/output/ex29.java b/output/ex29.java
new file mode 100644
index 0000000..30ea154
--- /dev/null
+++ b/output/ex29.java
@@ -0,0 +1,5 @@
+class ex29 {
+ public static void main(String[] a) {
+ int x ;
+ }
+}
diff --git a/output/ex29.vapor b/output/ex29.vapor
new file mode 100644
index 0000000..9d7cb5f
--- /dev/null
+++ b/output/ex29.vapor
@@ -0,0 +1,10 @@
+func Main()
+ ret
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex29.vaporm b/output/ex29.vaporm
new file mode 100644
index 0000000..cc9e00c
--- /dev/null
+++ b/output/ex29.vaporm
@@ -0,0 +1,42 @@
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex30.java b/output/ex30.java
new file mode 100644
index 0000000..4a5064d
--- /dev/null
+++ b/output/ex30.java
@@ -0,0 +1,11 @@
+class ex30 {
+ public static void main(String[] a) {
+ int x ;
+ }
+}
+
+class A {
+ public int foo() {
+ return 22 ;
+ }
+}
diff --git a/output/ex30.vapor b/output/ex30.vapor
new file mode 100644
index 0000000..03c3830
--- /dev/null
+++ b/output/ex30.vapor
@@ -0,0 +1,17 @@
+func Main()
+ ret
+
+const functable_A
+ :A_foo
+
+func A_foo(this )
+ t.0 = 22
+ ret t.0
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex30.vaporm b/output/ex30.vaporm
new file mode 100644
index 0000000..92e1e94
--- /dev/null
+++ b/output/ex30.vaporm
@@ -0,0 +1,65 @@
+const functable_A
+ :A_foo
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = 22
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex31.java b/output/ex31.java
new file mode 100644
index 0000000..d276e68
--- /dev/null
+++ b/output/ex31.java
@@ -0,0 +1,16 @@
+class ex31 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ }
+}
+
+class A {
+ public int foo() {
+ return 22 ;
+ }
+
+ public int bar() {
+ return 42 ;
+ }
+}
diff --git a/output/ex31.vapor b/output/ex31.vapor
new file mode 100644
index 0000000..127792e
--- /dev/null
+++ b/output/ex31.vapor
@@ -0,0 +1,25 @@
+func Main()
+ t.4 = HeapAllocZ(8)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ ret
+
+const functable_A
+ :A_foo
+ :A_bar
+
+func A_foo(this )
+ t.0 = 22
+ ret t.0
+
+func A_bar(this )
+ t.0 = 42
+ ret t.0
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex31.vaporm b/output/ex31.vaporm
new file mode 100644
index 0000000..43fee7b
--- /dev/null
+++ b/output/ex31.vaporm
@@ -0,0 +1,90 @@
+const functable_A
+ :A_foo
+ :A_bar
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(8 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = 22
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_bar [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = 42
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex32.java b/output/ex32.java
new file mode 100644
index 0000000..13e7dbb
--- /dev/null
+++ b/output/ex32.java
@@ -0,0 +1,14 @@
+class ex32 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo(12, 14, 15)) ;
+ }
+}
+
+class A {
+ int z ;
+ public int foo(int a, int b, int c) {
+ return 22 ;
+ }
+}
diff --git a/output/ex32.vapor b/output/ex32.vapor
new file mode 100644
index 0000000..4149aba
--- /dev/null
+++ b/output/ex32.vapor
@@ -0,0 +1,29 @@
+func Main()
+ t.4 = HeapAllocZ(8)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.8 = 12
+ t.9 = 14
+ t.10 = 15
+ t.5 = call t.7(t.3 t.8 t.9 t.10)
+ t.11 = t.5
+ PrintIntS(t.11)
+ ret
+
+const functable_A
+ :A_foo
+
+func A_foo(this t.0 t.1 t.2 )
+ t.3 = 22
+ ret t.3
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex32.vaporm b/output/ex32.vaporm
new file mode 100644
index 0000000..de9e55f
--- /dev/null
+++ b/output/ex32.vaporm
@@ -0,0 +1,103 @@
+const functable_A
+ :A_foo
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(8 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ $s7 = 12
+ $s4 = 14
+ $s3 = 15
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ $a2 = $s4
+ $a3 = $s3
+ call $s5
+ $s2 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s3 = $s2
+ PrintIntS($s3 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s5 = $a0
+ $s6 = $a1
+ $s7 = $a2
+ $s3 = $a3
+ $s4 = 22
+ $v0 = $s4
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex33.java b/output/ex33.java
new file mode 100644
index 0000000..d7f23ed
--- /dev/null
+++ b/output/ex33.java
@@ -0,0 +1,23 @@
+class ex33 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.bar(0-1, 400, 6*7)) ;
+ System.out.println(a.foo(0+1, 400)) ;
+ }
+}
+
+class A {
+
+ int o ;
+ int q ;
+
+ public int foo(int a, int b) {
+ o = 3 ;
+ return 22 ;
+ }
+
+ public int bar(int x, int y, int z) {
+ return 6 ;
+ }
+}
diff --git a/output/ex33.vapor b/output/ex33.vapor
new file mode 100644
index 0000000..4260958
--- /dev/null
+++ b/output/ex33.vapor
@@ -0,0 +1,52 @@
+func Main()
+ t.4 = HeapAllocZ(16)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+4]
+ t.9 = 0
+ t.10 = 1
+ t.8 = Sub(t.9 t.10)
+ t.14 = 6
+ t.15 = 7
+ t.13 = MulS(t.14 t.15)
+ t.11 = t.8
+ t.12 = 400
+ t.16 = t.13
+ t.5 = call t.7(t.3 t.14 t.15 t.16)
+ t.17 = t.5
+ PrintIntS(t.17)
+ t.3 = t.3
+ t.19 = [t.3+0]
+ t.20 = [t.19+0]
+ t.22 = 0
+ t.23 = 1
+ t.21 = Add(t.22 t.23)
+ t.24 = t.21
+ t.25 = 400
+ t.18 = call t.20(t.3 t.24 t.25)
+ t.26 = t.18
+ PrintIntS(t.26)
+ ret
+
+const functable_A
+ :A_foo
+ :A_bar
+
+func A_foo(this t.0 t.1 )
+ [this+8] = 3
+ t.2 = 22
+ ret t.2
+
+func A_bar(this t.0 t.1 t.2 )
+ t.3 = 6
+ ret t.3
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex33.vaporm b/output/ex33.vaporm
new file mode 100644
index 0000000..7ddba39
--- /dev/null
+++ b/output/ex33.vaporm
@@ -0,0 +1,167 @@
+const functable_A
+ :A_foo
+ :A_bar
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(16 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+4]
+ $s7 = 0
+ $s4 = 1
+ $s3 = Sub($s7 $s4 )
+ $s4 = 6
+ $s7 = 7
+ $s7 = MulS($s4 $s7 )
+ $s2 = $s3
+ $s2 = 400
+ $s2 = $s7
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s4
+ $a2 = $s7
+ $a3 = $s2
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s2 = $s7
+ PrintIntS($s2 )
+ $s6 = $s6
+ $s2 = [$s6+0]
+ $s7 = [$s2+0]
+ $s2 = 0
+ $s4 = 1
+ $s5 = Add($s2 $s4 )
+ $s4 = $s5
+ $s5 = 400
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s4
+ $a2 = $s5
+ call $s7
+ $s2 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s2
+ PrintIntS($s5 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s5 = $a0
+ $s6 = $a1
+ $s7 = $a2
+ [$s5+8] = 3
+ $s5 = 22
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_bar [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s5 = $a0
+ $s6 = $a1
+ $s7 = $a2
+ $s3 = $a3
+ $s4 = 6
+ $v0 = $s4
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex34.java b/output/ex34.java
new file mode 100644
index 0000000..eb5b18f
--- /dev/null
+++ b/output/ex34.java
@@ -0,0 +1,20 @@
+class ex34 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(1) ;
+ System.out.println(a.foo(2)) ;
+ }
+}
+
+class A {
+
+ int c ;
+
+ public int foo(int b) {
+ int c ;
+ c = 42 ;
+ return c ;
+ }
+
+}
diff --git a/output/ex34.vapor b/output/ex34.vapor
new file mode 100644
index 0000000..1b1cdc8
--- /dev/null
+++ b/output/ex34.vapor
@@ -0,0 +1,30 @@
+func Main()
+ t.4 = HeapAllocZ(8)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.5 = 1
+ PrintIntS(t.5)
+ t.3 = t.3
+ t.7 = [t.3+0]
+ t.8 = [t.7+0]
+ t.9 = 2
+ t.6 = call t.8(t.3 t.9)
+ t.10 = t.6
+ PrintIntS(t.10)
+ ret
+
+const functable_A
+ :A_foo
+
+func A_foo(this t.0 )
+ [this+4] = 42
+ t.1 = [this+4]
+ ret t.1
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex34.vaporm b/output/ex34.vaporm
new file mode 100644
index 0000000..d55289a
--- /dev/null
+++ b/output/ex34.vaporm
@@ -0,0 +1,100 @@
+const functable_A
+ :A_foo
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(8 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s7 = 1
+ PrintIntS($s7 )
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ $s7 = 2
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ call $s5
+ $s4 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s7 = $s4
+ PrintIntS($s7 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = $a1
+ [$s6+4] = 42
+ $s7 = [$s6+4]
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex35.java b/output/ex35.java
new file mode 100644
index 0000000..52585af
--- /dev/null
+++ b/output/ex35.java
@@ -0,0 +1,11 @@
+class ex35{
+ public static void main(String[] a){
+ System.out.println(new Fac().ComputeFac(10));
+ }
+}
+
+class Fac {
+ public int ComputeFac(int num){
+ return 4 ;
+ }
+}
diff --git a/output/ex35.vapor b/output/ex35.vapor
new file mode 100644
index 0000000..47ee28a
--- /dev/null
+++ b/output/ex35.vapor
@@ -0,0 +1,26 @@
+func Main()
+ t.3 = HeapAllocZ(4)
+ [t.3+0] = :functable_Fac
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.7 = 10
+ t.2 = call t.6(t.4 t.7)
+ t.8 = t.2
+ PrintIntS(t.8)
+ ret
+
+const functable_Fac
+ :Fac_ComputeFac
+
+func Fac_ComputeFac(this t.0 )
+ t.1 = 4
+ ret t.1
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex35.vaporm b/output/ex35.vaporm
new file mode 100644
index 0000000..175d589
--- /dev/null
+++ b/output/ex35.vaporm
@@ -0,0 +1,96 @@
+const functable_Fac
+ :Fac_ComputeFac
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(4 )
+ [$s7+0] = :functable_Fac
+ $s6 = $s7
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ $s7 = 10
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ call $s5
+ $s4 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s7 = $s4
+ PrintIntS($s7 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func Fac_ComputeFac [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s5 = $a0
+ $s6 = $a1
+ $s7 = 4
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex36.java b/output/ex36.java
new file mode 100644
index 0000000..333bd7d
--- /dev/null
+++ b/output/ex36.java
@@ -0,0 +1,15 @@
+class ex36{
+ public static void main(String[] a){
+ Fac b ;
+ b = new Fac() ;
+ System.out.println(b.ComputeFac(10));
+ }
+}
+
+class Fac {
+ public int ComputeFac(int num){
+ int num_aux ;
+ num_aux = 4 ;
+ return num_aux ;
+ }
+}
diff --git a/output/ex36.vapor b/output/ex36.vapor
new file mode 100644
index 0000000..ef01f49
--- /dev/null
+++ b/output/ex36.vapor
@@ -0,0 +1,28 @@
+func Main()
+ t.4 = HeapAllocZ(4)
+ [t.4+0] = :functable_Fac
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.8 = 10
+ t.5 = call t.7(t.3 t.8)
+ t.9 = t.5
+ PrintIntS(t.9)
+ ret
+
+const functable_Fac
+ :Fac_ComputeFac
+
+func Fac_ComputeFac(this t.0 )
+ t.1 = 4
+ t.2 = t.1
+ ret t.2
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex36.vaporm b/output/ex36.vaporm
new file mode 100644
index 0000000..a904a8f
--- /dev/null
+++ b/output/ex36.vaporm
@@ -0,0 +1,98 @@
+const functable_Fac
+ :Fac_ComputeFac
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(4 )
+ [$s7+0] = :functable_Fac
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ $s7 = 10
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ call $s5
+ $s4 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s7 = $s4
+ PrintIntS($s7 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func Fac_ComputeFac [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s5 = $a0
+ $s6 = $a1
+ $s7 = 4
+ $s5 = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex37.java b/output/ex37.java
new file mode 100644
index 0000000..867116a
--- /dev/null
+++ b/output/ex37.java
@@ -0,0 +1,20 @@
+class ex37 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo()) ;
+ }
+}
+
+class A {
+
+ public int foo() {
+ int v ;
+ v = 0 ;
+ while (v < 10) {
+ v = v + 1 ;
+ }
+ return v ;
+ }
+
+}
diff --git a/output/ex37.vapor b/output/ex37.vapor
new file mode 100644
index 0000000..616bf27
--- /dev/null
+++ b/output/ex37.vapor
@@ -0,0 +1,40 @@
+func Main()
+ t.4 = HeapAllocZ(4)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.5 = call t.7(t.3 )
+ t.8 = t.5
+ PrintIntS(t.8)
+ ret
+
+const functable_A
+ :A_foo
+
+func A_foo(this )
+ t.0 = 0
+while5_test:
+ t.2 = t.0
+ t.3 = 10
+ t.1 = LtS(t.2 t.3)
+ t.4 = t.1
+ if0 t.4 goto :while5_end
+while5_body:
+ t.6 = t.0
+ t.7 = 1
+ t.5 = Add(t.6 t.7)
+ t.0 = t.5
+ goto :while5_test
+while5_end:
+ t.8 = t.0
+ ret t.8
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex37.vaporm b/output/ex37.vaporm
new file mode 100644
index 0000000..1e4dea9
--- /dev/null
+++ b/output/ex37.vaporm
@@ -0,0 +1,108 @@
+const functable_A
+ :A_foo
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(4 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s7
+ PrintIntS($s5 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = 0
+while5_test:
+ $s6 = $s7
+ $s5 = 10
+ $s4 = LtS($s6 $s5 )
+ $s5 = $s4
+ if0 $s5 goto :while5_end
+while5_body:
+ $s5 = $s7
+ $s4 = 1
+ $s6 = Add($s5 $s4 )
+ $s7 = $s6
+ goto :while5_test
+while5_end:
+ $s6 = $s7
+ $v0 = $s6
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex38.java b/output/ex38.java
new file mode 100644
index 0000000..2a021eb
--- /dev/null
+++ b/output/ex38.java
@@ -0,0 +1,20 @@
+class ex38 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo()) ;
+ }
+}
+
+class A {
+
+ public int foo() {
+ int v ;
+ v = 0 ;
+ while (v < 10) {
+ v = v + 1 ;
+ }
+ return v ;
+ }
+
+}
diff --git a/output/ex38.vapor b/output/ex38.vapor
new file mode 100644
index 0000000..616bf27
--- /dev/null
+++ b/output/ex38.vapor
@@ -0,0 +1,40 @@
+func Main()
+ t.4 = HeapAllocZ(4)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.5 = call t.7(t.3 )
+ t.8 = t.5
+ PrintIntS(t.8)
+ ret
+
+const functable_A
+ :A_foo
+
+func A_foo(this )
+ t.0 = 0
+while5_test:
+ t.2 = t.0
+ t.3 = 10
+ t.1 = LtS(t.2 t.3)
+ t.4 = t.1
+ if0 t.4 goto :while5_end
+while5_body:
+ t.6 = t.0
+ t.7 = 1
+ t.5 = Add(t.6 t.7)
+ t.0 = t.5
+ goto :while5_test
+while5_end:
+ t.8 = t.0
+ ret t.8
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex38.vaporm b/output/ex38.vaporm
new file mode 100644
index 0000000..1e4dea9
--- /dev/null
+++ b/output/ex38.vaporm
@@ -0,0 +1,108 @@
+const functable_A
+ :A_foo
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(4 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s7
+ PrintIntS($s5 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = 0
+while5_test:
+ $s6 = $s7
+ $s5 = 10
+ $s4 = LtS($s6 $s5 )
+ $s5 = $s4
+ if0 $s5 goto :while5_end
+while5_body:
+ $s5 = $s7
+ $s4 = 1
+ $s6 = Add($s5 $s4 )
+ $s7 = $s6
+ goto :while5_test
+while5_end:
+ $s6 = $s7
+ $v0 = $s6
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex39.java b/output/ex39.java
new file mode 100644
index 0000000..23526de
--- /dev/null
+++ b/output/ex39.java
@@ -0,0 +1,12 @@
+class ex39 {
+ public static void main(String[] z) {
+ int a ;
+ int b ;
+ a = 0 ;
+ b = 2 * a ;
+ b = b + a ;
+ b = b - 1 ;
+ System.out.println(a) ;
+ System.out.println(b) ;
+ }
+}
diff --git a/output/ex39.vapor b/output/ex39.vapor
new file mode 100644
index 0000000..3ee23ea
--- /dev/null
+++ b/output/ex39.vapor
@@ -0,0 +1,27 @@
+func Main()
+ t.2 = 0
+ t.5 = 2
+ t.6 = t.2
+ t.4 = MulS(t.5 t.6)
+ t.3 = t.4
+ t.8 = t.3
+ t.9 = t.2
+ t.7 = Add(t.8 t.9)
+ t.3 = t.7
+ t.11 = t.3
+ t.12 = 1
+ t.10 = Sub(t.11 t.12)
+ t.3 = t.10
+ t.13 = t.2
+ PrintIntS(t.13)
+ t.14 = t.3
+ PrintIntS(t.14)
+ ret
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex39.vaporm b/output/ex39.vaporm
new file mode 100644
index 0000000..e787ca7
--- /dev/null
+++ b/output/ex39.vaporm
@@ -0,0 +1,59 @@
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = 0
+ $s6 = 2
+ $s5 = $s7
+ $s4 = MulS($s6 $s5 )
+ $s5 = $s4
+ $s4 = $s5
+ $s6 = $s7
+ $s6 = Add($s4 $s6 )
+ $s5 = $s6
+ $s6 = $s5
+ $s4 = 1
+ $s6 = Sub($s6 $s4 )
+ $s5 = $s6
+ $s6 = $s7
+ PrintIntS($s6 )
+ $s6 = $s5
+ PrintIntS($s6 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex40.java b/output/ex40.java
new file mode 100644
index 0000000..f2f121d
--- /dev/null
+++ b/output/ex40.java
@@ -0,0 +1,19 @@
+class ex40 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.add_two(12)) ;
+ }
+}
+
+class A {
+
+ int c ;
+
+ public int add_two(int b) {
+ c = 2 ;
+ b = b + c ;
+ return b ;
+ }
+
+}
diff --git a/output/ex40.vapor b/output/ex40.vapor
new file mode 100644
index 0000000..4aa976f
--- /dev/null
+++ b/output/ex40.vapor
@@ -0,0 +1,32 @@
+func Main()
+ t.4 = HeapAllocZ(8)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.8 = 12
+ t.5 = call t.7(t.3 t.8)
+ t.9 = t.5
+ PrintIntS(t.9)
+ ret
+
+const functable_A
+ :A_add_two
+
+func A_add_two(this t.0 )
+ [this+4] = 2
+ t.2 = t.0
+ t.3 = [this+4]
+ t.1 = Add(t.2 t.3)
+ t.0 = t.1
+ t.4 = t.0
+ ret t.4
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex40.vaporm b/output/ex40.vaporm
new file mode 100644
index 0000000..1f1f379
--- /dev/null
+++ b/output/ex40.vaporm
@@ -0,0 +1,102 @@
+const functable_A
+ :A_add_two
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(8 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ $s7 = 12
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ call $s5
+ $s4 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s7 = $s4
+ PrintIntS($s7 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_add_two [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = $a1
+ [$s6+4] = 2
+ $s5 = $s7
+ $s4 = [$s6+4]
+ $s6 = Add($s5 $s4 )
+ $s7 = $s6
+ $s6 = $s7
+ $v0 = $s6
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex41.java b/output/ex41.java
new file mode 100644
index 0000000..e07e962
--- /dev/null
+++ b/output/ex41.java
@@ -0,0 +1,25 @@
+class ex41 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo()) ;
+ }
+}
+
+class A {
+
+ public int foo() {
+ int v ;
+ int w ;
+ v = 0 ;
+ w = 0 ;
+ while (v < 10) {
+ while (w < 100) {
+ w = w + 1 ;
+ }
+ v = v + 1 ;
+ }
+ return w ;
+ }
+
+}
diff --git a/output/ex41.vapor b/output/ex41.vapor
new file mode 100644
index 0000000..e1ce5bd
--- /dev/null
+++ b/output/ex41.vapor
@@ -0,0 +1,54 @@
+func Main()
+ t.4 = HeapAllocZ(4)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.5 = call t.7(t.3 )
+ t.8 = t.5
+ PrintIntS(t.8)
+ ret
+
+const functable_A
+ :A_foo
+
+func A_foo(this )
+ t.0 = 0
+ t.1 = 0
+while5_test:
+ t.3 = t.0
+ t.4 = 10
+ t.2 = LtS(t.3 t.4)
+ t.5 = t.2
+ if0 t.5 goto :while5_end
+while5_body:
+while10_test:
+ t.7 = t.1
+ t.8 = 100
+ t.6 = LtS(t.7 t.8)
+ t.9 = t.6
+ if0 t.9 goto :while10_end
+while10_body:
+ t.11 = t.1
+ t.12 = 1
+ t.10 = Add(t.11 t.12)
+ t.1 = t.10
+ goto :while10_test
+while10_end:
+ t.14 = t.0
+ t.15 = 1
+ t.13 = Add(t.14 t.15)
+ t.0 = t.13
+ goto :while5_test
+while5_end:
+ t.16 = t.1
+ ret t.16
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex41.vaporm b/output/ex41.vaporm
new file mode 100644
index 0000000..78f1ba0
--- /dev/null
+++ b/output/ex41.vaporm
@@ -0,0 +1,122 @@
+const functable_A
+ :A_foo
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(4 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s7
+ PrintIntS($s5 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = 0
+ $s6 = 0
+while5_test:
+ $s5 = $s7
+ $s4 = 10
+ $s3 = LtS($s5 $s4 )
+ $s4 = $s3
+ if0 $s4 goto :while5_end
+while5_body:
+while10_test:
+ $s4 = $s6
+ $s3 = 100
+ $s5 = LtS($s4 $s3 )
+ $s3 = $s5
+ if0 $s3 goto :while10_end
+while10_body:
+ $s3 = $s6
+ $s5 = 1
+ $s4 = Add($s3 $s5 )
+ $s6 = $s4
+ goto :while10_test
+while10_end:
+ $s4 = $s7
+ $s3 = 1
+ $s5 = Add($s4 $s3 )
+ $s7 = $s5
+ goto :while5_test
+while5_end:
+ $s5 = $s6
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex42.vapor b/output/ex42.vapor
new file mode 100644
index 0000000..dc17699
--- /dev/null
+++ b/output/ex42.vapor
@@ -0,0 +1,36 @@
+func Main()
+ t.4 = HeapAllocZ(24)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.8 = 42
+ t.9 = 10000
+ t.10 = 1
+ t.11 = 156
+ t.12 = 123
+ t.5 = call t.7(t.3 t.8 t.9 t.10 t.11 t.12)
+ t.13 = t.5
+ PrintIntS(t.13)
+ ret
+
+const functable_A
+ :A_Init
+
+func A_Init(this t.0 t.1 t.2 t.3 t.4 )
+ [this+4] = t.0
+ [this+8] = t.1
+ [this+12] = t.2
+ [this+16] = t.3
+ [this+20] = t.4
+ t.5 = 1
+ ret t.5
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex42.vaporm b/output/ex42.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/ex42.vaporm
diff --git a/output/ex43.java b/output/ex43.java
new file mode 100644
index 0000000..80657d9
--- /dev/null
+++ b/output/ex43.java
@@ -0,0 +1,22 @@
+class ex43 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo()) ;
+ }
+}
+
+class A {
+
+ public int foo() {
+ int v ;
+ v = 1 ;
+ if (5 < v) {
+ System.out.println(1) ;
+ } else {
+ System.out.println(0) ;
+ }
+ return v ;
+ }
+
+}
diff --git a/output/ex43.vapor b/output/ex43.vapor
new file mode 100644
index 0000000..08eb00d
--- /dev/null
+++ b/output/ex43.vapor
@@ -0,0 +1,40 @@
+func Main()
+ t.4 = HeapAllocZ(4)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.5 = call t.7(t.3 )
+ t.8 = t.5
+ PrintIntS(t.8)
+ ret
+
+const functable_A
+ :A_foo
+
+func A_foo(this )
+ t.0 = 1
+ t.2 = 5
+ t.3 = t.0
+ t.1 = LtS(t.2 t.3)
+ t.4 = t.1
+ if0 t.4 goto :if5_else
+if5_body:
+ t.5 = 1
+ PrintIntS(t.5)
+ goto :if5_end
+if5_else:
+ t.6 = 0
+ PrintIntS(t.6)
+if5_end:
+ t.7 = t.0
+ ret t.7
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex43.vaporm b/output/ex43.vaporm
new file mode 100644
index 0000000..ea6a2a2
--- /dev/null
+++ b/output/ex43.vaporm
@@ -0,0 +1,108 @@
+const functable_A
+ :A_foo
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(4 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s7
+ PrintIntS($s5 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = 1
+ $s6 = 5
+ $s5 = $s7
+ $s4 = LtS($s6 $s5 )
+ $s5 = $s4
+ if0 $s5 goto :if5_else
+if5_body:
+ $s5 = 1
+ PrintIntS($s5 )
+ goto :if5_end
+if5_else:
+ $s5 = 0
+ PrintIntS($s5 )
+if5_end:
+ $s5 = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex44.java b/output/ex44.java
new file mode 100644
index 0000000..06c8d55
--- /dev/null
+++ b/output/ex44.java
@@ -0,0 +1,16 @@
+class ex44{
+ public static void main(String[] a){
+ System.out.println(new Operator().compute());
+ }
+}
+
+class Operator{
+
+ boolean result;
+
+ public int compute(){
+ boolean result ;
+ result = true && false;
+ return 0 ;
+ }
+}
diff --git a/output/ex44.vapor b/output/ex44.vapor
new file mode 100644
index 0000000..6ad8e68
--- /dev/null
+++ b/output/ex44.vapor
@@ -0,0 +1,31 @@
+func Main()
+ t.3 = HeapAllocZ(8)
+ [t.3+0] = :functable_Operator
+ t.4 = t.3
+ t.5 = [t.4+0]
+ t.6 = [t.5+0]
+ t.2 = call t.6(t.4 )
+ t.7 = t.2
+ PrintIntS(t.7)
+ ret
+
+const functable_Operator
+ :Operator_compute
+
+func Operator_compute(this )
+ t.1 = 1
+ t.2 = 0
+ t.3 = Eq(1 t.1)
+ t.4 = Eq(1 t.2)
+ t.0 = Eq(t.3 t.4)
+ [this+4] = t.0
+ t.5 = 0
+ ret t.5
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex44.vaporm b/output/ex44.vaporm
new file mode 100644
index 0000000..dbe6454
--- /dev/null
+++ b/output/ex44.vaporm
@@ -0,0 +1,99 @@
+const functable_Operator
+ :Operator_compute
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(8 )
+ [$s7+0] = :functable_Operator
+ $s6 = $s7
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s7
+ PrintIntS($s5 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func Operator_compute [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = 1
+ $s5 = 0
+ $s4 = Eq(1 $s7 )
+ $s7 = Eq(1 $s5 )
+ $s5 = Eq($s4 $s7 )
+ [$s6+4] = $s5
+ $s5 = 0
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex45.java b/output/ex45.java
new file mode 100644
index 0000000..72f85d4
--- /dev/null
+++ b/output/ex45.java
@@ -0,0 +1,19 @@
+class ex45 {
+ public static void main(String[] z) {
+ int result ;
+ A a ;
+ a = new A() ;
+ result = a.run() ;
+ System.out.println(result) ;
+ }
+}
+
+class A {
+
+ int[] arr ;
+
+ public int run() {
+ arr = new int[10] ;
+ return arr.length ;
+ }
+}
diff --git a/output/ex45.vapor b/output/ex45.vapor
new file mode 100644
index 0000000..7adf817
--- /dev/null
+++ b/output/ex45.vapor
@@ -0,0 +1,31 @@
+func Main()
+ t.4 = HeapAllocZ(8)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.7 = [t.3+0]
+ t.8 = [t.7+0]
+ t.6 = call t.8(t.3 )
+ t.5 = t.6
+ t.9 = t.5
+ PrintIntS(t.9)
+ ret
+
+const functable_A
+ :A_run
+
+func A_run(this )
+ t.0 = call :AllocArray(10)
+ [this+4] = t.0
+ t.2 = [this+4]
+ t.1 = [t.2+0]
+ t.3 = t.1
+ ret t.3
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex45.vaporm b/output/ex45.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/ex45.vaporm
diff --git a/output/ex46.java b/output/ex46.java
new file mode 100644
index 0000000..55724d6
--- /dev/null
+++ b/output/ex46.java
@@ -0,0 +1,32 @@
+class ex46 {
+ public static void main(String[] z) {
+ int result ;
+ A a ;
+ a = new A() ;
+ System.out.println(a.foo()) ;
+ System.out.println(a.foo()) ;
+ result = a.bar(10, 20);
+ System.out.println(result) ;
+ }
+}
+
+class A {
+
+ int c ;
+ int d ;
+
+ public int foo() {
+ d = 0 ;
+ c = 1 + 2 ;
+ d = c + d ;
+ return d ;
+ }
+
+ public int bar(int a, int b) {
+ int result ;
+ c = a ;
+ d = b ;
+ result = c * d ;
+ return result ;
+ }
+}
diff --git a/output/ex46.vapor b/output/ex46.vapor
new file mode 100644
index 0000000..282da13
--- /dev/null
+++ b/output/ex46.vapor
@@ -0,0 +1,61 @@
+func Main()
+ t.4 = HeapAllocZ(16)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.5 = call t.7(t.3 )
+ t.8 = t.5
+ PrintIntS(t.8)
+ t.3 = t.3
+ t.10 = [t.3+0]
+ t.11 = [t.10+0]
+ t.9 = call t.11(t.3 )
+ t.12 = t.9
+ PrintIntS(t.12)
+ t.3 = t.3
+ t.15 = [t.3+0]
+ t.16 = [t.15+4]
+ t.17 = 10
+ t.18 = 20
+ t.14 = call t.16(t.3 t.17 t.18)
+ t.13 = t.14
+ t.19 = t.13
+ PrintIntS(t.19)
+ ret
+
+const functable_A
+ :A_foo
+ :A_bar
+
+func A_foo(this )
+ [this+12] = 0
+ t.1 = 1
+ t.2 = 2
+ t.0 = Add(t.1 t.2)
+ [this+8] = t.0
+ t.4 = [this+8]
+ t.5 = [this+12]
+ t.3 = Add(t.4 t.5)
+ [this+12] = t.3
+ t.6 = [this+12]
+ ret t.6
+
+func A_bar(this t.0 t.1 )
+ [this+8] = t.0
+ [this+12] = t.1
+ t.4 = [this+8]
+ t.5 = [this+12]
+ t.3 = MulS(t.4 t.5)
+ t.2 = t.3
+ t.6 = t.2
+ ret t.6
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex46.vaporm b/output/ex46.vaporm
new file mode 100644
index 0000000..888892f
--- /dev/null
+++ b/output/ex46.vaporm
@@ -0,0 +1,190 @@
+const functable_A
+ :A_foo
+ :A_bar
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(16 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s7
+ PrintIntS($s5 )
+ $s6 = $s6
+ $s5 = [$s6+0]
+ $s7 = [$s5+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s7
+ $s5 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s7 = $s5
+ PrintIntS($s7 )
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+4]
+ $s7 = 10
+ $s4 = 20
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ $a2 = $s4
+ call $s5
+ $s3 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s4 = $s3
+ $s3 = $s4
+ PrintIntS($s3 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_foo [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ [$s7+12] = 0
+ $s6 = 1
+ $s5 = 2
+ $s4 = Add($s6 $s5 )
+ [$s7+8] = $s4
+ $s4 = [$s7+8]
+ $s6 = [$s7+12]
+ $s5 = Add($s4 $s6 )
+ [$s7+12] = $s5
+ $s5 = [$s7+12]
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_bar [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s5 = $a0
+ $s6 = $a1
+ $s7 = $a2
+ [$s5+8] = $s6
+ [$s5+12] = $s7
+ $s7 = [$s5+8]
+ $s6 = [$s5+12]
+ $s5 = MulS($s7 $s6 )
+ $s6 = $s5
+ $s5 = $s6
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex47.java b/output/ex47.java
new file mode 100644
index 0000000..ea4e342
--- /dev/null
+++ b/output/ex47.java
@@ -0,0 +1,24 @@
+class ex47 {
+ public static void main(String[] z) {
+ int result ;
+ A a ;
+ a = new A() ;
+ System.out.println(a.set(42)) ;
+ System.out.println(a.get()) ;
+ }
+}
+
+class A {
+
+ int[] x ;
+
+ public int set(int b) {
+ x = new int[12] ;
+ x[5] = b ;
+ return x.length ;
+ }
+
+ public int get() {
+ return x[5] ;
+ }
+}
diff --git a/output/ex47.vapor b/output/ex47.vapor
new file mode 100644
index 0000000..e035a56
--- /dev/null
+++ b/output/ex47.vapor
@@ -0,0 +1,52 @@
+func Main()
+ t.4 = HeapAllocZ(12)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.8 = 42
+ t.5 = call t.7(t.3 t.8)
+ t.9 = t.5
+ PrintIntS(t.9)
+ t.3 = t.3
+ t.11 = [t.3+0]
+ t.12 = [t.11+4]
+ t.10 = call t.12(t.3 )
+ t.13 = t.10
+ PrintIntS(t.13)
+ ret
+
+const functable_A
+ :A_set
+ :A_get
+
+func A_set(this t.0 )
+ t.1 = call :AllocArray(12)
+ [this+8] = t.1
+ t.2 = [this+8]
+ t.3 = MulS(5 4)
+ t.3 = Add(t.3 4)
+ t.3 = Add(t.2 t.3)
+ [t.3] = t.0
+ t.5 = [this+8]
+ t.4 = [t.5+0]
+ t.6 = t.4
+ ret t.6
+
+func A_get(this )
+ t.1 = [this+8]
+ t.2 = MulS(5 4)
+ t.2 = Add(t.2 4)
+ t.2 = Add(t.1 t.2)
+ t.0 = [t.2]
+ t.3 = t.0
+ ret t.3
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex47.vaporm b/output/ex47.vaporm
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/output/ex47.vaporm
diff --git a/output/ex48.java b/output/ex48.java
new file mode 100644
index 0000000..21424ba
--- /dev/null
+++ b/output/ex48.java
@@ -0,0 +1,23 @@
+class ex48 {
+ public static void main(String[] z) {
+ int result ;
+ A a ;
+ a = new A() ;
+ System.out.println(a.set(42)) ;
+ System.out.println(a.get()) ;
+ }
+}
+
+class A {
+
+ int x ;
+
+ public int set(int b) {
+ x = b ;
+ return x ;
+ }
+
+ public int get() {
+ return x ;
+ }
+}
diff --git a/output/ex48.vapor b/output/ex48.vapor
new file mode 100644
index 0000000..3a30098
--- /dev/null
+++ b/output/ex48.vapor
@@ -0,0 +1,39 @@
+func Main()
+ t.4 = HeapAllocZ(12)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.8 = 42
+ t.5 = call t.7(t.3 t.8)
+ t.9 = t.5
+ PrintIntS(t.9)
+ t.3 = t.3
+ t.11 = [t.3+0]
+ t.12 = [t.11+4]
+ t.10 = call t.12(t.3 )
+ t.13 = t.10
+ PrintIntS(t.13)
+ ret
+
+const functable_A
+ :A_set
+ :A_get
+
+func A_set(this t.0 )
+ [this+8] = t.0
+ t.1 = [this+8]
+ ret t.1
+
+func A_get(this )
+ t.0 = [this+8]
+ ret t.0
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex48.vaporm b/output/ex48.vaporm
new file mode 100644
index 0000000..dfa4c39
--- /dev/null
+++ b/output/ex48.vaporm
@@ -0,0 +1,146 @@
+const functable_A
+ :A_set
+ :A_get
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(12 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ $s7 = 42
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ $a1 = $s7
+ call $s5
+ $s4 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s7 = $s4
+ PrintIntS($s7 )
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s4 = [$s7+4]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s4
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s4 = $s7
+ PrintIntS($s4 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_set [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = $a1
+ [$s6+8] = $s7
+ $s7 = [$s6+8]
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_get [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = [$s6+8]
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex49.java b/output/ex49.java
new file mode 100644
index 0000000..d28a887
--- /dev/null
+++ b/output/ex49.java
@@ -0,0 +1,26 @@
+class ex49 {
+ public static void main(String[] z) {
+ int result ;
+ A a ;
+ a = new A() ;
+ System.out.println(a.set()) ;
+ }
+}
+
+class A {
+
+ int b ;
+
+ public int set() {
+ b = 3 ;
+ return 1 ;
+ }
+}
+
+class B extends A {
+
+ public int get() {
+ b = 12 ;
+ return b ;
+ }
+}
diff --git a/output/ex49.vapor b/output/ex49.vapor
new file mode 100644
index 0000000..ad216d4
--- /dev/null
+++ b/output/ex49.vapor
@@ -0,0 +1,36 @@
+func Main()
+ t.4 = HeapAllocZ(8)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.5 = call t.7(t.3 )
+ t.8 = t.5
+ PrintIntS(t.8)
+ ret
+
+const functable_A
+ :A_set
+
+func A_set(this )
+ [this+4] = 3
+ t.0 = 1
+ ret t.0
+
+const functable_B
+ :B_get
+ :A_set
+
+func B_get(this )
+ [this+8] = 12
+ t.0 = [this+8]
+ ret t.0
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex49.vaporm b/output/ex49.vaporm
new file mode 100644
index 0000000..185ff18
--- /dev/null
+++ b/output/ex49.vaporm
@@ -0,0 +1,120 @@
+const functable_A
+ :A_set
+const functable_B
+ :B_get
+ :A_set
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(8 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s7
+ PrintIntS($s5 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_set [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ [$s7+4] = 3
+ $s7 = 1
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func B_get [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ [$s7+8] = 12
+ $s6 = [$s7+8]
+ $v0 = $s6
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/ex50.java b/output/ex50.java
new file mode 100644
index 0000000..576af0e
--- /dev/null
+++ b/output/ex50.java
@@ -0,0 +1,35 @@
+class ex50 {
+ public static void main(String[] z) {
+ int result ;
+ A a ;
+ a = new A() ;
+ System.out.println(a.set_get()) ;
+ }
+}
+
+class A {
+
+ B b ;
+
+ public int set_get() {
+ int r ;
+ b = new B() ;
+ r = b.set() ;
+ r = b.get() ;
+ return r ;
+ }
+}
+
+class B {
+
+ int x ;
+
+ public int get() {
+ return x ;
+ }
+
+ public int set() {
+ x = 12 ;
+ return 1 ;
+ }
+}
diff --git a/output/ex50.vapor b/output/ex50.vapor
new file mode 100644
index 0000000..8c2f4ef
--- /dev/null
+++ b/output/ex50.vapor
@@ -0,0 +1,52 @@
+func Main()
+ t.4 = HeapAllocZ(8)
+ [t.4+0] = :functable_A
+ t.3 = t.4
+ t.3 = t.3
+ t.6 = [t.3+0]
+ t.7 = [t.6+0]
+ t.5 = call t.7(t.3 )
+ t.8 = t.5
+ PrintIntS(t.8)
+ ret
+
+const functable_A
+ :A_set_get
+
+func A_set_get(this )
+ t.0 = HeapAllocZ(12)
+ [t.0+0] = :functable_B
+ [this+4] = t.0
+ t.3 = [this+4]
+ t.4 = [t.3+0]
+ t.5 = [t.4+4]
+ t.2 = call t.5(t.3 )
+ t.1 = t.2
+ t.3 = [this+4]
+ t.7 = [t.3+0]
+ t.8 = [t.7+0]
+ t.6 = call t.8(t.3 )
+ t.1 = t.6
+ t.9 = t.1
+ ret t.9
+
+const functable_B
+ :B_get
+ :B_set
+
+func B_get(this )
+ t.0 = [this+8]
+ ret t.0
+
+func B_set(this )
+ [this+8] = 12
+ t.0 = 1
+ ret t.0
+
+func AllocArray(size)
+ bytes = MulS(size 4)
+ bytes = Add(bytes 4)
+ v = HeapAllocZ(bytes)
+ [v] = size
+ ret v
+
diff --git a/output/ex50.vaporm b/output/ex50.vaporm
new file mode 100644
index 0000000..6b0a1d6
--- /dev/null
+++ b/output/ex50.vaporm
@@ -0,0 +1,193 @@
+const functable_A
+ :A_set_get
+const functable_B
+ :B_get
+ :B_set
+func Main [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = HeapAllocZ(8 )
+ [$s7+0] = :functable_A
+ $s6 = $s7
+ $s6 = $s6
+ $s7 = [$s6+0]
+ $s5 = [$s7+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s6
+ call $s5
+ $s7 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s5 = $s7
+ PrintIntS($s5 )
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func A_set_get [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = HeapAllocZ(12 )
+ [$s7+0] = :functable_B
+ [$s6+4] = $s7
+ $s7 = [$s6+4]
+ $s5 = [$s7+0]
+ $s4 = [$s5+4]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s7
+ call $s4
+ $s5 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s4 = $s5
+ $s7 = [$s6+4]
+ $s6 = [$s7+0]
+ $s5 = [$s6+0]
+ local[8] = $t0
+ local[9] = $t1
+ local[10] = $t2
+ local[11] = $t3
+ local[12] = $t4
+ local[13] = $t5
+ local[14] = $t6
+ local[15] = $t7
+ local[16] = $t8
+ $a0 = $s7
+ call $s5
+ $s6 = $v0
+ $t0 = local[8]
+ $t1 = local[9]
+ $t2 = local[10]
+ $t3 = local[11]
+ $t4 = local[12]
+ $t5 = local[13]
+ $t6 = local[14]
+ $t7 = local[15]
+ $t8 = local[16]
+ $s4 = $s6
+ $s6 = $s4
+ $v0 = $s6
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func B_get [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s6 = $a0
+ $s7 = [$s6+8]
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func B_set [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ [$s7+8] = 12
+ $s7 = 1
+ $v0 = $s7
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
+func AllocArray [in 0, out 0, local 17]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ local[3] = $s3
+ local[4] = $s4
+ local[5] = $s5
+ local[6] = $s6
+ local[7] = $s7
+ $s7 = $a0
+ $s6 = MulS($s7 4 )
+ $s6 = Add($s6 4 )
+ $s5 = HeapAllocZ($s6 )
+ [$s5+0] = $s7
+ $v0 = $s5
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ $s3 = local[3]
+ $s4 = local[4]
+ $s5 = local[5]
+ $s6 = local[6]
+ $s7 = local[7]
+ ret
diff --git a/output/negative/ArrayEqualsBool-error.java b/output/negative/ArrayEqualsBool-error.java
new file mode 100644
index 0000000..bedcc48
--- /dev/null
+++ b/output/negative/ArrayEqualsBool-error.java
@@ -0,0 +1,381 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+ int[] x ;
+
+ x = new int[6] ;
+
+
+ x[2] = false ;
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/ArrayEqualsClass-error.java b/output/negative/ArrayEqualsClass-error.java
new file mode 100644
index 0000000..12024cb
--- /dev/null
+++ b/output/negative/ArrayEqualsClass-error.java
@@ -0,0 +1,380 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+ int[] x ;
+
+ x = new int[6] ;
+
+ x[2] = current_node ;
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/AssignWrongType-error1.java b/output/negative/AssignWrongType-error1.java
new file mode 100644
index 0000000..73c44b8
--- /dev/null
+++ b/output/negative/AssignWrongType-error1.java
@@ -0,0 +1,378 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+ int x ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ x = false ; // TE
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadAdd-error1.java b/output/negative/BadAdd-error1.java
new file mode 100644
index 0000000..0c26e54
--- /dev/null
+++ b/output/negative/BadAdd-error1.java
@@ -0,0 +1,376 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + left ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadAnd-error1.java b/output/negative/BadAnd-error1.java
new file mode 100644
index 0000000..79786d0
--- /dev/null
+++ b/output/negative/BadAnd-error1.java
@@ -0,0 +1,376 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.Search(12) )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadArrayAlloc-error1.java b/output/negative/BadArrayAlloc-error1.java
new file mode 100644
index 0000000..21f1b50
--- /dev/null
+++ b/output/negative/BadArrayAlloc-error1.java
@@ -0,0 +1,380 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+ int[] x ;
+
+ x = new int[false] ;
+
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadCompare-error1.java b/output/negative/BadCompare-error1.java
new file mode 100644
index 0000000..4d7d91c
--- /dev/null
+++ b/output/negative/BadCompare-error1.java
@@ -0,0 +1,376 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < true) // TE
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadIf-error1.java b/output/negative/BadIf-error1.java
new file mode 100644
index 0000000..fa7d692
--- /dev/null
+++ b/output/negative/BadIf-error1.java
@@ -0,0 +1,376 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1) ntb = false ; // TE
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadLookup-error1.java b/output/negative/BadLookup-error1.java
new file mode 100644
index 0000000..a0c7130
--- /dev/null
+++ b/output/negative/BadLookup-error1.java
@@ -0,0 +1,382 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+ int y ;
+ int[] x ;
+
+ x = new int[8] ;
+
+ x[6] = 6 ;
+ y = x[ntb] ;
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadLookup-error2.java b/output/negative/BadLookup-error2.java
new file mode 100644
index 0000000..b1843d3
--- /dev/null
+++ b/output/negative/BadLookup-error2.java
@@ -0,0 +1,382 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+ int y ;
+ int[] x ;
+
+ x = new int[8] ;
+
+ x[6] = 6 ;
+ y = y[6] ;
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadMinus-error1.java b/output/negative/BadMinus-error1.java
new file mode 100644
index 0000000..2baa802
--- /dev/null
+++ b/output/negative/BadMinus-error1.java
@@ -0,0 +1,378 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+ int x ;
+
+ x = 0 - current_node ;
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadMul-error1.java b/output/negative/BadMul-error1.java
new file mode 100644
index 0000000..9ca8e2a
--- /dev/null
+++ b/output/negative/BadMul-error1.java
@@ -0,0 +1,380 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+ int x ;
+
+
+ x = x * ntb ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BadPrint-error.java b/output/negative/BadPrint-error.java
new file mode 100644
index 0000000..9ee7efa
--- /dev/null
+++ b/output/negative/BadPrint-error.java
@@ -0,0 +1,26 @@
+class ex42 {
+ public static void main(String[] z) {
+ A a ;
+ a = new A() ;
+ System.out.println(a.Init(42, 10000, true, 156, 123)) ;
+ }
+}
+
+class A {
+
+ int age ;
+ int Salary ;
+ boolean Married ;
+ int weight ;
+ int height ;
+
+ public boolean Init(int v_age, int v_Salary, boolean v_Married, int v_weight, int v_height) {
+ age = v_age ;
+ Salary = v_Salary ;
+ Married = v_Married ;
+ weight = v_weight ;
+ height = v_height ;
+ return true ;
+ }
+
+}
diff --git a/output/negative/BadWhile-error1.java b/output/negative/BadWhile-error1.java
new file mode 100644
index 0000000..a5a1dbe
--- /dev/null
+++ b/output/negative/BadWhile-error1.java
@@ -0,0 +1,376 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (ifound){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/BinaryTree-error.java b/output/negative/BinaryTree-error.java
new file mode 100644
index 0000000..d9be857
--- /dev/null
+++ b/output/negative/BinaryTree-error.java
@@ -0,0 +1,334 @@
+class BinaryTree{
+ public static void main(String[] a){
+ System.out.println(new BT().Start());
+ }
+}
+
+
+// This class invokes the methods to create a tree,
+// insert, delete and serach for elements on it
+class BT {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Print();
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(); // TE, should be Delete(12)
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+ // Initialize a node with a key value and no children
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ // Update the right child with rn
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ // Update the left child with ln
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ // This method compares two integers and
+ // returns true if they are equal and false
+ // otherwise
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+
+ // Insert a new element in the tree
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ boolean cont ;
+ int key_aux ;
+ Tree current_node ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+
+ // Delete an element from the tree
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean is_root ;
+ int key_aux ;
+ boolean ntb ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if ((!current_node.GetHas_Right()) &&
+ (!current_node.GetHas_Left()) )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+
+ // Check if the element to be removed will use the
+ // righ or left subtree if one exists
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ //auxtree01 = p_node.GetLeft() ;
+ //auxkey2 = auxtree01.GetKey() ;
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+
+ // Copy the child key to the parent until a leaf is
+ // found and remove the leaf. This is done with the
+ // right subtree
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+
+ while (c_node.GetHas_Right()){
+ //auxtree01 = c_node.GetRight() ;
+ //auxint02 = auxtree01.GetKey();
+ //ntb = c_node.SetKey(auxint02);
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+
+ // Copy the child key to the parent until a leaf is
+ // found and remove the leaf. This is done with the
+ // left subtree
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+
+ while (c_node.GetHas_Left()){
+ //auxtree01 = c_node.GetLeft() ;
+ //auxint02 = auxtree01.GetKey();
+ //ntb = c_node.SetKey(auxint02);
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+ // Search for an elemnt in the tree
+ public int Search(int v_key){
+ boolean cont ;
+ int ifound ;
+ Tree current_node;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ // Invoke the method to really print the tree elements
+ public boolean Print(){
+ Tree current_node;
+ boolean ntb ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ // Print the elements of the tree
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ //auxtree01 = node.GetLeft() ;
+ //ntb = this.RecPrint(auxtree01);
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ //auxtree01 = node.GetRight() ;
+ //ntb = this.RecPrint(auxtree01);
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+}
+
diff --git a/output/negative/BubbleSort-error.java b/output/negative/BubbleSort-error.java
new file mode 100644
index 0000000..97a1c1d
--- /dev/null
+++ b/output/negative/BubbleSort-error.java
@@ -0,0 +1,93 @@
+class BubbleSort{
+ public static void main(String[] a){
+ System.out.println(new BBS().Start(10));
+ }
+}
+
+
+// This class contains the array of integers and
+// methods to initialize, print and sort the array
+// using Bublesort
+class BBS{
+
+ int[] number ;
+ int size ;
+
+ // Invoke the Initialization, Sort and Printing
+ // Methods
+ public int Start(int sz){
+ int aux01 ;
+ aux01 = this.Init(sz);
+ aux01 = this.Print();
+ System.out.println(99999);
+ aux01 = this.Sort();
+ aux01 = this.Print();
+ return 0 ;
+ }
+
+
+ // Sort array of integers using Bublesort method
+ public int Sort(){
+ int nt ;
+ int i ;
+ int aux02 ;
+ int aux04 ;
+ int aux05 ;
+ int aux06 ;
+ int aux07 ;
+ int j ;
+ int t ;
+ i = size - 1 ;
+ aux02 = 0 - 1 ;
+ while (aux02 < i) {
+ j = 1 ;
+ //aux03 = i+1 ;
+ while (j < (i+1)){
+ aux07 = j - 1 ;
+ aux04 = number[aux07] ;
+ aux05 = number[j] ;
+ if (aux05 < aux04) {
+ aux06 = j - 1 ;
+ t = number[aux06] ;
+ number[aux06] = number[j] ;
+ number[j] = t;
+ }
+ else nt = 0 ;
+ j = j + 1 ;
+ }
+ i = i - 1 ;
+ }
+ return 0 ;
+ }
+
+ // Printing method
+ public int Print(){
+ int j ;
+ j = 0 ;
+ while (j < (size)) {
+ System.out.println(number[j]);
+ j = j + 1 ;
+ }
+ return 0 ;
+ }
+
+ // Initialize array of integers
+ public int Init(int sz){
+ size = sz1 ; //TE
+ number = new int[sz] ;
+
+ number[0] = 20 ;
+ number[1] = 7 ;
+ number[2] = 12 ;
+ number[3] = 18 ;
+ number[4] = 2 ;
+ number[5] = 11 ;
+ number[6] = 6 ;
+ number[7] = 9 ;
+ number[8] = 19 ;
+ number[9] = 5 ;
+
+ return 0 ;
+ }
+
+}
diff --git a/output/negative/Factorial-error.java b/output/negative/Factorial-error.java
new file mode 100644
index 0000000..46ec59a
--- /dev/null
+++ b/output/negative/Factorial-error.java
@@ -0,0 +1,16 @@
+class Factorial{
+ public static void main(String[] a){
+ System.out.println(new Fac().ComputeFac(10));
+ }
+}
+
+class Fac {
+ public boolean ComputeFac(int num){ //TE
+ int num_aux ;
+ if (num < 1)
+ num_aux = 1 ;
+ else
+ num_aux = num * (this.ComputeFac(num-1)) ;
+ return num_aux ;
+ }
+}
diff --git a/output/negative/ImpossibleLength-error.java b/output/negative/ImpossibleLength-error.java
new file mode 100644
index 0000000..1e905e7
--- /dev/null
+++ b/output/negative/ImpossibleLength-error.java
@@ -0,0 +1,379 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+ int x ;
+
+ x = ntb.length ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/IndexNonArray-error1.java b/output/negative/IndexNonArray-error1.java
new file mode 100644
index 0000000..c6b0135
--- /dev/null
+++ b/output/negative/IndexNonArray-error1.java
@@ -0,0 +1,377 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ ntb[8] = 0 ;
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/LinearSearch-error.java b/output/negative/LinearSearch-error.java
new file mode 100644
index 0000000..f8c48fe
--- /dev/null
+++ b/output/negative/LinearSearch-error.java
@@ -0,0 +1,99 @@
+class LinearSearch{
+ public static void main(String[] a){
+ System.out.println(new LS().Start(10));
+ }
+}
+
+
+// This class contains an array of integers and
+// methods to initialize, print and search the array
+// using Linear Search
+class LS {
+ int number ; //TE
+ int size ;
+
+ // Invoke methods to initialize, print and search
+ // for elements on the array
+ public int Start(int sz){
+ int aux01 ;
+ int aux02 ;
+
+ aux01 = this.Init(sz);
+ aux02 = this.Print();
+ System.out.println(9999);
+ System.out.println(this.Search(8));
+ System.out.println(this.Search(12)) ;
+ System.out.println(this.Search(17)) ;
+ System.out.println(this.Search(50)) ;
+ return 55 ;
+ }
+
+ // Print array of integers
+ public int Print(){
+ int j ;
+
+ j = 1 ;
+ while (j < (size)) {
+ System.out.println(number[j]);
+ j = j + 1 ;
+ }
+ return 0 ;
+ }
+
+ // Search for a specific value (num) using
+ // linear search
+ public int Search(int num){
+ int j ;
+ boolean ls01 ;
+ int ifound ;
+ int aux01 ;
+ int aux02 ;
+ int nt ;
+
+ j = 1 ;
+ ls01 = false ;
+ ifound = 0 ;
+
+ //System.out.println(num);
+ while (j < (size)) {
+ aux01 = number[j] ;
+ aux02 = num + 1 ;
+ if (aux01 < num) nt = 0 ;
+ else if (!(aux01 < aux02)) nt = 0 ;
+ else {
+ ls01 = true ;
+ ifound = 1 ;
+ j = size ;
+ }
+ j = j + 1 ;
+ }
+
+ return ifound ;
+ }
+
+
+
+ // initialize array of integers with some
+ // some sequence
+ public int Init(int sz){
+ int j ;
+ int k ;
+ int aux01 ;
+ int aux02 ;
+
+ size = sz ;
+ number = new int[sz] ;
+
+ j = 1 ;
+ k = size + 1 ;
+ while (j < (size)) {
+ aux01 = 2 * j ;
+ aux02 = k - 3 ;
+ number[j] = aux01 + aux02 ;
+ j = j + 1 ;
+ k = k - 1 ;
+ }
+ return 0 ;
+ }
+
+}
diff --git a/output/negative/LinkedList-error.java b/output/negative/LinkedList-error.java
new file mode 100644
index 0000000..181b599
--- /dev/null
+++ b/output/negative/LinkedList-error.java
@@ -0,0 +1,278 @@
+class LinkedList{
+ public static void main(String[] a){
+ System.out.println(new LL().Start());
+ }
+}
+
+class Element {
+ int Age ;
+ int Salary ;
+ boolean Married ;
+
+ // Initialize some class variables
+ public boolean Init(int v_Age, int v_Salary, boolean v_Married){
+ Age = v_Age ;
+ Salary = v_Salary ;
+ Married = v_Married ;
+ return true ;
+ }
+
+ public int GetAge(){
+ return Age ;
+ }
+
+ public int GetSalary(){
+ return Salary ;
+ }
+
+ public boolean GetMarried(){
+ return Married ;
+ }
+
+ // This method returns true if the object "other"
+ // has the same values for age, salary and
+ public boolean Equal(Element other){
+ boolean ret_val ;
+ int aux01 ;
+ int aux02 ;
+ int nt ;
+ ret_val = true ;
+
+ aux01 = other.GetAge();
+ if (!this.Compare(aux01,Age)) ret_val = false ;
+ else {
+ aux02 = other.GetSalary();
+ if (!this.Compare(aux02,Salary)) ret_val = false ;
+ else
+ if (Married)
+ if (!other.GetMarried()) ret_val = false;
+ else nt = 0 ;
+ else
+ if (other.GetMarried()) ret_val = false;
+ else nt = 0 ;
+ }
+
+ return ret_val ;
+ }
+
+ // This method compares two integers and
+ // returns true if they are equal and false
+ // otherwise
+ public boolean Compare(int num1 , int num2){
+ boolean retval ;
+ int aux02 ;
+ retval = false ;
+ aux02 = num2 + 1 ;
+ if (num1 < num2) retval = false ;
+ else if (!(num1 < aux02)) retval = false ;
+ else retval = true ;
+ return retval ;
+ }
+
+}
+
+class List{
+ Element elem ;
+ List next ;
+ boolean end ;
+
+ // Initialize the node list as the last node
+ public boolean Init(){
+ end = true ;
+ return true ;
+ }
+
+ // Initialize the values of a new node
+ public boolean InitNew(Element v_elem, List v_next, boolean v_end){
+ end = v_end ;
+ elem = v_elem ;
+ next = v_next ;
+ return true ;
+ }
+
+ // Insert a new node at the beginning of the list
+ public List Insert(Element new_elem){
+ boolean ret_val ;
+ List aux03 ;
+ List aux02 ;
+ aux03 = this ;
+ aux02 = new List();
+ ret_val = aux02.InitNew(new_elem,aux03,false);
+ return aux02 ;
+ }
+
+
+ // Update the the pointer to the next node
+ public boolean SetNext(List v_next){
+ next = v_next ;
+ return 0 ; //TE
+ }
+
+ // Delete an element e from the list
+ public List Delete(Element e){
+ List my_head ;
+ boolean ret_val ;
+ boolean aux05;
+ List aux01 ;
+ List prev ;
+ boolean var_end ;
+ Element var_elem ;
+ int aux04 ;
+ int nt ;
+
+
+ my_head = this ;
+ ret_val = false ;
+ aux04 = 0 - 1 ;
+ aux01 = this ;
+ prev = this ;
+ var_end = end;
+ var_elem = elem ;
+ while ((!var_end) && (!ret_val)){
+ if (e.Equal(var_elem)){
+ ret_val = true ;
+ if (aux04 < 0) {
+ // delete first element
+ my_head = aux01.GetNext() ;
+ }
+ else{ // delete a non first element
+ System.out.println(0-555);
+ aux05 = prev.SetNext(aux01.GetNext());
+ System.out.println(0-555);
+
+ }
+ } else nt = 0 ;
+ if (!ret_val){
+ prev = aux01 ;
+ aux01 = aux01.GetNext() ;
+ var_end = aux01.GetEnd();
+ var_elem = aux01.GetElem();
+ aux04 = 1 ;
+ } else nt = 0 ;
+ }
+ return my_head ;
+ }
+
+
+ // Search for an element e on the list
+ public int Search(Element e){
+ int int_ret_val ;
+ List aux01 ;
+ Element var_elem ;
+ boolean var_end ;
+ int nt ;
+
+ int_ret_val = 0 ;
+ aux01 = this ;
+ var_end = end;
+ var_elem = elem ;
+ while (!var_end){
+ if (e.Equal(var_elem)){
+ int_ret_val = 1 ;
+ }
+ else nt = 0 ;
+ aux01 = aux01.GetNext() ;
+ var_end = aux01.GetEnd();
+ var_elem = aux01.GetElem();
+ }
+ return int_ret_val ;
+ }
+
+ public boolean GetEnd(){
+ return end ;
+ }
+
+ public Element GetElem(){
+ return elem ;
+ }
+
+ public List GetNext(){
+ return next ;
+ }
+
+
+ // Print the linked list
+ public boolean Print(){
+ List aux01 ;
+ boolean var_end ;
+ Element var_elem ;
+
+ aux01 = this ;
+ var_end = end ;
+ var_elem = elem ;
+ while (!var_end){
+ System.out.println(var_elem.GetAge());
+ aux01 = aux01.GetNext() ;
+ var_end = aux01.GetEnd();
+ var_elem = aux01.GetElem();
+ }
+
+ return true ;
+ }
+}
+
+
+// this class invokes the methods to insert, delete,
+// search and print the linked list
+class LL{
+
+ public int Start(){
+
+ List head ;
+ List last_elem ;
+ boolean aux01 ;
+ Element el01 ;
+ Element el02 ;
+ Element el03 ;
+
+ last_elem = new List();
+ aux01 = last_elem.Init();
+ head = last_elem ;
+ aux01 = head.Init();
+ aux01 = head.Print();
+
+ // inserting first element
+ el01 = new Element();
+ aux01 = el01.Init(25,37000,false);
+ head = head.Insert(el01);
+ aux01 = head.Print();
+ System.out.println(10000000);
+ // inserting second element
+ el01 = new Element();
+ aux01 = el01.Init(39,42000,true);
+ el02 = el01 ;
+ head = head.Insert(el01);
+ aux01 = head.Print();
+ System.out.println(10000000);
+ // inserting third element
+ el01 = new Element();
+ aux01 = el01.Init(22,34000,false);
+ head = head.Insert(el01);
+ aux01 = head.Print();
+ el03 = new Element();
+ aux01 = el03.Init(27,34000,false);
+ System.out.println(head.Search(el02));
+ System.out.println(head.Search(el03));
+ System.out.println(10000000);
+ // inserting fourth element
+ el01 = new Element();
+ aux01 = el01.Init(28,35000,false);
+ head = head.Insert(el01);
+ aux01 = head.Print();
+ System.out.println(2220000);
+
+ head = head.Delete(el02);
+ aux01 = head.Print();
+ System.out.println(33300000);
+
+
+ head = head.Delete(el01);
+ aux01 = head.Print();
+ System.out.println(44440000);
+
+ return 0 ;
+
+
+ }
+
+}
diff --git a/output/negative/MissingAssign-error1.java b/output/negative/MissingAssign-error1.java
new file mode 100644
index 0000000..dc5a2f4
--- /dev/null
+++ b/output/negative/MissingAssign-error1.java
@@ -0,0 +1,377 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ x = 0 ;
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/MissingCall-error1.java b/output/negative/MissingCall-error1.java
new file mode 100644
index 0000000..14469ef
--- /dev/null
+++ b/output/negative/MissingCall-error1.java
@@ -0,0 +1,29 @@
+class MoreThan4{
+ public static void main(String[] a){
+ System.out.println(new MT4().Start(1,2,3,4,5,6));
+ }
+}
+
+class MT4 {
+ public int Start(int p1, int p2, int p3 , int p4, int p5, int p6){
+ int aux ;
+ System.out.println(p1);
+ System.out.println(p2);
+ System.out.println(p3);
+ System.out.println(p4);
+ System.out.println(p5);
+ System.out.println(p6);
+ aux = this.Next(p6,p5,p4,p3,p2,p1);
+ return aux ;
+ }
+
+ public int Change(int p1, int p2, int p3 , int p4, int p5, int p6){
+ System.out.println(p1);
+ System.out.println(p2);
+ System.out.println(p3);
+ System.out.println(p4);
+ System.out.println(p5);
+ System.out.println(p6);
+ return 0 ;
+ }
+}
diff --git a/output/negative/MissingCall-error2.java b/output/negative/MissingCall-error2.java
new file mode 100644
index 0000000..a735a2c
--- /dev/null
+++ b/output/negative/MissingCall-error2.java
@@ -0,0 +1,112 @@
+class QuickSort{
+ public static void main(String[] a){
+ System.out.println(new QS().Start(10));
+ }
+}
+
+
+// This class contains the array of integers and
+// methods to initialize, print and sort the array
+// using Quicksort
+class QS{
+
+ int number ; //TE
+ int size ;
+
+ // Invoke the Initialization, Sort and Printing
+ // Methods
+ public int Start(int sz){
+ int aux01 ;
+ aux01 = this.Init(sz);
+ aux01 = this.Print();
+ System.out.println(9999);
+ aux01 = size - 1 ;
+ aux01 = this.Sort(0,aux01);
+ aux01 = aux01.Print();
+ return 0 ;
+ }
+
+
+ // Sort array of integers using Quicksort method
+ public int Sort(int left, int right){
+ int v ;
+ int i ;
+ int j ;
+ int nt;
+ int t ;
+ boolean cont01;
+ boolean cont02;
+ int aux03 ;
+ t = 0 ;
+ if (left < right){
+ v = number[right] ;
+ i = left - 1 ;
+ j = right ;
+ cont01 = true ;
+ while (cont01){
+ cont02 = true ;
+ while (cont02){
+ i = i + 1 ;
+ aux03 = number[i] ;
+ if (!(aux03<v)) cont02 = false ;
+ else cont02 = true ;
+ }
+ cont02 = true ;
+ while (cont02){
+ j = j - 1 ;
+ aux03 = number[j] ;
+ if (!(v < aux03)) cont02 = false ;
+ else cont02 = true ;
+ }
+
+
+ t = number[i] ;
+ number[i] = number[j] ;
+ number[j] = t ;
+ //aux03 = i + 1 ;
+ if ( j < (i+1)) cont01 = false ;
+ else cont01 = true ;
+ }
+ number[j] = number[i] ;
+ number[i] = number[right] ;
+ number[right] = t ;
+ nt = this.Sort(left,i-1);
+ nt = this.Sort(i+1,right);
+ }
+ else nt = 0 ;
+ return 0 ;
+ }
+
+
+ // Print array of integers
+ public int Print(){
+ int j ;
+ j = 0 ;
+ while (j < (size)) {
+ System.out.println(number[j]);
+ j = j + 1 ;
+ }
+ return 0 ;
+ }
+
+
+ // Initialize array of integers
+ public int Init(int sz){
+ size = sz ;
+ number = new int[sz] ;
+
+ number[0] = 20 ;
+ number[1] = 7 ;
+ number[2] = 12 ;
+ number[3] = 18 ;
+ number[4] = 2 ;
+ number[5] = 11 ;
+ number[6] = 6 ;
+ number[7] = 9 ;
+ number[8] = 19 ;
+ number[9] = 5 ;
+
+ return 0 ;
+ }
+
+}
diff --git a/output/negative/MissingCall-error3.java b/output/negative/MissingCall-error3.java
new file mode 100644
index 0000000..4a5b956
--- /dev/null
+++ b/output/negative/MissingCall-error3.java
@@ -0,0 +1,377 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+
+ if (nti.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/NotASubType-error1.java b/output/negative/NotASubType-error1.java
new file mode 100644
index 0000000..d1c3b25
--- /dev/null
+++ b/output/negative/NotASubType-error1.java
@@ -0,0 +1,384 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+ Tree x ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ MyVisitor y ;
+ Visitor x ;
+
+ y = new MyVisitor() ;
+
+ y = x ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/QuickSort-error.java b/output/negative/QuickSort-error.java
new file mode 100644
index 0000000..ff4ea2e
--- /dev/null
+++ b/output/negative/QuickSort-error.java
@@ -0,0 +1,112 @@
+class QuickSort{
+ public static void main(String[] a){
+ System.out.println(new QS().Start(10));
+ }
+}
+
+
+// This class contains the array of integers and
+// methods to initialize, print and sort the array
+// using Quicksort
+class QS{
+
+ int number ; //TE
+ int size ;
+
+ // Invoke the Initialization, Sort and Printing
+ // Methods
+ public int Start(int sz){
+ int aux01 ;
+ aux01 = this.Init(sz);
+ aux01 = this.Print();
+ System.out.println(9999);
+ aux01 = size - 1 ;
+ aux01 = this.Sort(0,aux01);
+ aux01 = this.Print();
+ return 0 ;
+ }
+
+
+ // Sort array of integers using Quicksort method
+ public int Sort(int left, int right){
+ int v ;
+ int i ;
+ int j ;
+ int nt;
+ int t ;
+ boolean cont01;
+ boolean cont02;
+ int aux03 ;
+ t = 0 ;
+ if (left < right){
+ v = number[right] ;
+ i = left - 1 ;
+ j = right ;
+ cont01 = true ;
+ while (cont01){
+ cont02 = true ;
+ while (cont02){
+ i = i + 1 ;
+ aux03 = number[i] ;
+ if (!(aux03<v)) cont02 = false ;
+ else cont02 = true ;
+ }
+ cont02 = true ;
+ while (cont02){
+ j = j - 1 ;
+ aux03 = number[j] ;
+ if (!(v < aux03)) cont02 = false ;
+ else cont02 = true ;
+ }
+
+
+ t = number[i] ;
+ number[i] = number[j] ;
+ number[j] = t ;
+ //aux03 = i + 1 ;
+ if ( j < (i+1)) cont01 = false ;
+ else cont01 = true ;
+ }
+ number[j] = number[i] ;
+ number[i] = number[right] ;
+ number[right] = t ;
+ nt = this.Sort(left,i-1);
+ nt = this.Sort(i+1,right);
+ }
+ else nt = 0 ;
+ return 0 ;
+ }
+
+
+ // Print array of integers
+ public int Print(){
+ int j ;
+ j = 0 ;
+ while (j < (size)) {
+ System.out.println(number[j]);
+ j = j + 1 ;
+ }
+ return 0 ;
+ }
+
+
+ // Initialize array of integers
+ public int Init(int sz){
+ size = sz ;
+ number = new int[sz] ;
+
+ number[0] = 20 ;
+ number[1] = 7 ;
+ number[2] = 12 ;
+ number[3] = 18 ;
+ number[4] = 2 ;
+ number[5] = 11 ;
+ number[6] = 6 ;
+ number[7] = 9 ;
+ number[8] = 19 ;
+ number[9] = 5 ;
+
+ return 0 ;
+ }
+
+}
diff --git a/output/negative/TreeVisitor-error.java b/output/negative/TreeVisitor-error.java
new file mode 100644
index 0000000..b41f3d1
--- /dev/null
+++ b/output/negative/TreeVisitor-error.java
@@ -0,0 +1,376 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ //Tree r ; //TE
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}
diff --git a/output/negative/WrongReturn-error1.java b/output/negative/WrongReturn-error1.java
new file mode 100644
index 0000000..d0e4264
--- /dev/null
+++ b/output/negative/WrongReturn-error1.java
@@ -0,0 +1,378 @@
+// The classes are basically the same as the BinaryTree
+// file except the visitor classes and the accept method
+// in the Tree class
+
+class TreeVisitor{
+ public static void main(String[] a){
+ System.out.println(new TV().Start());
+ }
+}
+
+class TV {
+
+ public int Start(){
+ Tree root ;
+ boolean ntb ;
+ int nti ;
+ MyVisitor v ;
+
+ root = new Tree();
+ ntb = root.Init(16);
+ ntb = root.Print();
+ System.out.println(100000000);
+ ntb = root.Insert(8) ;
+ ntb = root.Insert(24) ;
+ ntb = root.Insert(4) ;
+ ntb = root.Insert(12) ;
+ ntb = root.Insert(20) ;
+ ntb = root.Insert(28) ;
+ ntb = root.Insert(14) ;
+ ntb = root.Print();
+ System.out.println(100000000);
+ v = new MyVisitor();
+ System.out.println(50000000);
+ nti = root.accept(v);
+ System.out.println(100000000);
+ System.out.println(root.Search(24));
+ System.out.println(root.Search(12));
+ System.out.println(root.Search(16));
+ System.out.println(root.Search(50));
+ System.out.println(root.Search(12));
+ ntb = root.Delete(12);
+ ntb = root.Print();
+ System.out.println(root.Search(12));
+
+ return 0 ;
+ }
+
+}
+
+
+class Tree{
+ Tree left ;
+ Tree right;
+ int key ;
+ boolean has_left ;
+ boolean has_right ;
+ Tree my_null ;
+
+
+
+ //Tree new_node ;
+ //Tree current_node ;
+ //Tree parent_node ;
+
+ // boolean ntb ;
+ //boolean cont ;
+ //boolean found ;
+ //int ifound ;
+ // boolean is_root ;
+ // int nti ;
+ // int key_aux ;
+ // int auxkey1 ;
+ // int auxkey2 ;
+
+ public boolean Init(int v_key){
+ key = v_key ;
+ has_left = false ;
+ has_right = false ;
+ return true ;
+ }
+
+ public boolean SetRight(Tree rn){
+ right = rn ;
+ return true ;
+ }
+
+ public boolean SetLeft(Tree ln){
+ left = ln ;
+ return true ;
+ }
+
+ public Tree GetRight(){
+ return right ;
+ }
+
+ public Tree GetLeft(){
+ return left;
+ }
+
+ public int GetKey(){
+ return key ;
+ }
+
+ public boolean SetKey(int v_key){
+ key = v_key ;
+ return true ;
+ }
+
+ public boolean GetHas_Right(){
+ return has_right ;
+ }
+
+ public boolean GetHas_Left(){
+ return has_left ;
+ }
+
+ public boolean SetHas_Left(boolean val){
+ has_left = val ;
+ return true ;
+ }
+
+ public boolean SetHas_Right(boolean val){
+ has_right = val ;
+ return true ;
+ }
+
+ public boolean Compare(int num1 , int num2){
+ boolean ntb ;
+ int nti ;
+
+ ntb = false ;
+ nti = num2 + 1 ;
+ if (num1 < num2) ntb = false ;
+ else if (!(num1 < nti)) ntb = false ;
+ else ntb = true ;
+ return ntb ;
+ }
+
+ public boolean Insert(int v_key){
+ Tree new_node ;
+ boolean ntb ;
+ Tree current_node ;
+ boolean cont ;
+ int key_aux ;
+
+ new_node = new Tree();
+ ntb = new_node.Init(v_key) ;
+ current_node = this ;
+ cont = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux){
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Left(true);
+ ntb = current_node.SetLeft(new_node);
+ }
+ }
+ else{
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else {
+ cont = false ;
+ ntb = current_node.SetHas_Right(true);
+ ntb = current_node.SetRight(new_node);
+ }
+ }
+ }
+ return true ;
+ }
+
+ public boolean Delete(int v_key){
+ Tree current_node ;
+ Tree parent_node ;
+ boolean cont ;
+ boolean found ;
+ boolean ntb ;
+ boolean is_root ;
+ int key_aux ;
+
+ current_node = this ;
+ parent_node = this ;
+ cont = true ;
+ found = false ;
+ is_root = true ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left()){
+ parent_node = current_node ;
+ current_node = current_node.GetLeft() ;
+ }
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right()){
+ parent_node = current_node ;
+ current_node = current_node.GetRight() ;
+ }
+ else cont = false ;
+ else {
+ if (is_root)
+ if (!current_node.GetHas_Right() &&
+ !current_node.GetHas_Left() )
+ ntb = true ;
+ else
+ ntb = this.Remove(parent_node,current_node);
+ else ntb = this.Remove(parent_node,current_node);
+ found = true ;
+ cont = false ;
+ }
+ is_root = false ;
+ }
+ return found ;
+ }
+
+ public boolean Remove(Tree p_node, Tree c_node){
+ boolean ntb ;
+ int auxkey1 ;
+ int auxkey2 ;
+
+ if (c_node.GetHas_Left())
+ ntb = this.RemoveLeft(p_node,c_node) ;
+ else
+ if (c_node.GetHas_Right())
+ ntb = this.RemoveRight(p_node,c_node) ;
+ else {
+ auxkey1 = c_node.GetKey();
+ auxkey2 = (p_node.GetLeft()).GetKey() ;
+ if (this.Compare(auxkey1,auxkey2)) {
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ }
+ else {
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ }
+ }
+ return true ;
+ }
+
+ public boolean RemoveRight(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Right()){
+ ntb = c_node.SetKey((c_node.GetRight()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetRight() ;
+ }
+ ntb = p_node.SetRight(my_null);
+ ntb = p_node.SetHas_Right(false);
+ return true ;
+ }
+
+ public boolean RemoveLeft(Tree p_node, Tree c_node){
+ boolean ntb ;
+ while (c_node.GetHas_Left()){
+ ntb = c_node.SetKey((c_node.GetLeft()).GetKey());
+ p_node = c_node ;
+ c_node = c_node.GetLeft() ;
+ }
+ ntb = p_node.SetLeft(my_null);
+ ntb = p_node.SetHas_Left(false);
+ return true ;
+ }
+
+
+ public int Search(int v_key){
+ Tree current_node ;
+ int ifound ;
+ boolean cont ;
+ int key_aux ;
+
+ current_node = this ;
+ cont = true ;
+ ifound = 0 ;
+ while (cont){
+ key_aux = current_node.GetKey();
+ if (v_key < key_aux)
+ if (current_node.GetHas_Left())
+ current_node = current_node.GetLeft() ;
+ else cont = false ;
+ else
+ if (key_aux < v_key)
+ if (current_node.GetHas_Right())
+ current_node = current_node.GetRight() ;
+ else cont = false ;
+ else {
+ ifound = 1 ;
+ cont = false ;
+ }
+ }
+ return ifound ;
+ }
+
+ public boolean Print(){
+ boolean ntb ;
+ Tree current_node ;
+
+ current_node = this ;
+ ntb = this.RecPrint(current_node);
+ return true ;
+ }
+
+ public boolean RecPrint(Tree node){
+ boolean ntb ;
+
+ if (node.GetHas_Left()){
+ ntb = this.RecPrint(node.GetLeft());
+ } else ntb = true ;
+ System.out.println(node.GetKey());
+ if (node.GetHas_Right()){
+ ntb = this.RecPrint(node.GetRight());
+ } else ntb = true ;
+ return true ;
+ }
+
+ public int accept(Visitor v){
+ int nti ;
+
+ System.out.println(333);
+ nti = v.visit(this) ;
+ return 0 ;
+ }
+
+}
+
+
+
+class Visitor {
+ Tree l ;
+ Tree r ; //TE
+
+ public int visit(Tree n){
+ int nti ;
+ int[] c ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti = l.accept(this) ; }
+ else nti = 0 ;
+
+ c = new int[3] ;
+ return c;
+ }
+
+}
+
+
+class MyVisitor extends Visitor {
+
+ Tree r;
+
+ public int visit(Tree n){
+ int nti ;
+
+ if (n.GetHas_Right()){
+ r = n.GetRight() ;
+ nti = r.accept(this) ; }
+ else nti = 0 ;
+
+ System.out.println(n.GetKey());
+
+ if (n.GetHas_Left()) {
+ l = n.GetLeft();
+ nti =l.accept(this) ; }
+ else nti = 0 ;
+
+ return 0;
+ }
+
+}