diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-15 22:30:43 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-15 22:30:43 -0600 |
commit | 3415badef847db518daa9b46c6274ac3fb89f56d (patch) | |
tree | b32c7d9408416dab208d7670fd51da47710efad8 /boil | |
parent | 4d8e11688a54ef6b2cf0ba85f7879b5d8dbeec48 (diff) |
HW3 Test runner script
Diffstat (limited to 'boil')
28 files changed, 72 insertions, 5743 deletions
diff --git a/boil/library/BoilSimp.java b/boil/library/BoilSimp.java index 9a69b2c..fd5b389 100644 --- a/boil/library/BoilSimp.java +++ b/boil/library/BoilSimp.java @@ -166,7 +166,7 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { } this.vapor += "\n"; n.f2.accept(this, symt); - n.f3.accept(this, symt); + // n.f3.accept(this, symt); n.f4.accept(this, symt); n.f5.accept(this, symt); @@ -212,7 +212,7 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { TypeInstance t = symt.getType(id); this.vapor += String.format(" %s = HeapAllocZ(%d)\n", this.tf.alias(t), - t.getSize()); // FIXME add proper allocation size + t.getSize()); this.vapor += String.format(" if0 %s goto :error\n", this.tf.alias(symt.getType(id))); n.f2.accept(this, symt); @@ -254,19 +254,22 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { for (TypeInstance attr : symt.getMethod(id) .getClassInstance() .getLocals()) { - String.format(" %s = this\n", - this.tf.alias(attr)); + this.vapor += String.format(" %s = this\n", + this.tf.alias(attr)); } n.f7.accept(this, symt); n.f8.accept(this, symt); n.f9.accept(this, symt); - n.f10.accept(this, symt); // FIXME + String ret = n.f10.accept(this, symt); // FIXME n.f11.accept(this, symt); n.f12.accept(this, symt); - this.vapor += " ret\n\n"; - + TypeInstance tp1 = new TypeInstance("tp1", TypeEnum.ERROR); + this.vapor += String.format(" %s = %s\n ret %s\n\n", + this.tf.alias(tp1), + ret, + this.tf.alias(tp1)); symt.removeActive(TypeEnum.method); return mod; @@ -389,10 +392,20 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { String mod = ""; String id = n.f0.accept(this, symt); - vapor += String.format(" [%s] = ", this.tf.alias(symt.getType(id))); + + ClassInstance cls; + int attr_index = (cls = symt.getClass(symt.getActive(TypeEnum.classname))) + .getLocals().indexOf(symt.getType(id)) * 4; + + if (attr_index < 0) + attr_index = 0; + else + attr_index += cls.getMethods().size() * 4; + n.f1.accept(this, symt); - vapor += n.f2.accept(this, symt); + n.f2.accept(this, symt); n.f3.accept(this, symt); + return mod; } @@ -472,8 +485,8 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { TypeInstance tp1 = new TypeInstance("tp1", TypeEnum.ERROR); vapor += String.format(" %s = %s\n", - this.tf.alias(tp1), - expr); + this.tf.alias(tp1), + expr); vapor += String.format(" PrintIntS(%s)\n", this.tf.retrieveRecentList(1)); @@ -625,6 +638,9 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { TypeInstance cur = symt.getType(id); + System.out.println("id: " + id); + System.out.println("id2: " + id2); + System.out.println("cur: " + symt.getType(id)); int mtdIndex = cur.getClassInstance() .getMethods().indexOf(symt.getMethod(id2)) * 4; @@ -778,11 +794,15 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { String mod = ""; n.f0.accept(this, symt); String cls = n.f1.accept(this, symt); - mod += String.format(":functable_%s\n", cls); + vapor += String.format(" [%s+%d] = :functable_%s\n", + this.tf.retrieveRecentList(1), + 0, + cls); + System.out.println(vapor); n.f2.accept(this, symt); n.f3.accept(this, symt); - return mod; + return cls; } /** diff --git a/boil/tests/BinaryTree.opt.vapor b/boil/tests/BinaryTree.opt.vapor deleted file mode 100644 index ef6ac4e..0000000 --- a/boil/tests/BinaryTree.opt.vapor +++ /dev/null @@ -1,526 +0,0 @@ - -const empty_BT - -const empty_Tree - - -func Main() - t.0 = call :BT.Start(:empty_BT) - PrintIntS(t.0) - ret - -func BT.Start(this) - root = HeapAllocZ(24) - if root goto :null1 - Error("null pointer") - null1: - ntb = call :Tree.Init(root 16) - if root goto :null2 - Error("null pointer") - null2: - ntb = call :Tree.Print(root) - PrintIntS(100000000) - if root goto :null3 - Error("null pointer") - null3: - ntb = call :Tree.Insert(root 8) - if root goto :null4 - Error("null pointer") - null4: - ntb = call :Tree.Print(root) - if root goto :null5 - Error("null pointer") - null5: - ntb = call :Tree.Insert(root 24) - if root goto :null6 - Error("null pointer") - null6: - ntb = call :Tree.Insert(root 4) - if root goto :null7 - Error("null pointer") - null7: - ntb = call :Tree.Insert(root 12) - if root goto :null8 - Error("null pointer") - null8: - ntb = call :Tree.Insert(root 20) - if root goto :null9 - Error("null pointer") - null9: - ntb = call :Tree.Insert(root 28) - if root goto :null10 - Error("null pointer") - null10: - ntb = call :Tree.Insert(root 14) - if root goto :null11 - Error("null pointer") - null11: - ntb = call :Tree.Print(root) - if root goto :null12 - Error("null pointer") - null12: - t.0 = call :Tree.Search(root 24) - PrintIntS(t.0) - if root goto :null13 - Error("null pointer") - null13: - t.1 = call :Tree.Search(root 12) - PrintIntS(t.1) - if root goto :null14 - Error("null pointer") - null14: - t.2 = call :Tree.Search(root 16) - PrintIntS(t.2) - if root goto :null15 - Error("null pointer") - null15: - t.3 = call :Tree.Search(root 50) - PrintIntS(t.3) - if root goto :null16 - Error("null pointer") - null16: - t.4 = call :Tree.Search(root 12) - PrintIntS(t.4) - if root goto :null17 - Error("null pointer") - null17: - ntb = call :Tree.Delete(root 12) - if root goto :null18 - Error("null pointer") - null18: - ntb = call :Tree.Print(root) - if root goto :null19 - Error("null pointer") - null19: - t.5 = call :Tree.Search(root 12) - PrintIntS(t.5) - ret 0 - -func Tree.Init(this v_key) - [this+8] = v_key - [this+12] = 0 - [this+16] = 0 - ret 1 - -func Tree.SetRight(this rn) - [this+4] = rn - ret 1 - -func Tree.SetLeft(this ln) - [this+0] = ln - ret 1 - -func Tree.GetRight(this) - t.0 = [this+4] - ret t.0 - -func Tree.GetLeft(this) - t.0 = [this+0] - ret t.0 - -func Tree.GetKey(this) - t.0 = [this+8] - ret t.0 - -func Tree.SetKey(this v_key) - [this+8] = v_key - ret 1 - -func Tree.GetHas_Right(this) - t.0 = [this+16] - ret t.0 - -func Tree.GetHas_Left(this) - t.0 = [this+12] - ret t.0 - -func Tree.SetHas_Left(this val) - [this+12] = val - ret 1 - -func Tree.SetHas_Right(this val) - [this+16] = val - ret 1 - -func Tree.Compare(this num1 num2) - ntb = 0 - nti = Add(num2 1) - t.0 = LtS(num1 num2) - if0 t.0 goto :if1_else - ntb = 0 - goto :if1_end - if1_else: - t.1 = LtS(num1 nti) - if t.1 goto :if2_else - ntb = 0 - goto :if2_end - if2_else: - ntb = 1 - if2_end: - if1_end: - ret ntb - -func Tree.Insert(this v_key) - new_node = HeapAllocZ(24) - if new_node goto :null20 - Error("null pointer") - null20: - ntb = call :Tree.Init(new_node v_key) - current_node = this - cont = 1 - while1_top: - if0 cont goto :while1_end - if current_node goto :null21 - Error("null pointer") - null21: - key_aux = call :Tree.GetKey(current_node) - t.0 = LtS(v_key key_aux) - if0 t.0 goto :if3_else - if current_node goto :null22 - Error("null pointer") - null22: - t.1 = call :Tree.GetHas_Left(current_node) - if0 t.1 goto :if4_else - if current_node goto :null23 - Error("null pointer") - null23: - current_node = call :Tree.GetLeft(current_node) - goto :if4_end - if4_else: - cont = 0 - if current_node goto :null24 - Error("null pointer") - null24: - ntb = call :Tree.SetHas_Left(current_node 1) - if current_node goto :null25 - Error("null pointer") - null25: - ntb = call :Tree.SetLeft(current_node new_node) - if4_end: - goto :if3_end - if3_else: - if current_node goto :null26 - Error("null pointer") - null26: - t.2 = call :Tree.GetHas_Right(current_node) - if0 t.2 goto :if5_else - if current_node goto :null27 - Error("null pointer") - null27: - current_node = call :Tree.GetRight(current_node) - goto :if5_end - if5_else: - cont = 0 - if current_node goto :null28 - Error("null pointer") - null28: - ntb = call :Tree.SetHas_Right(current_node 1) - if current_node goto :null29 - Error("null pointer") - null29: - ntb = call :Tree.SetRight(current_node new_node) - if5_end: - if3_end: - goto :while1_top - while1_end: - ret 1 - -func Tree.Delete(this v_key) - current_node = this - parent_node = this - cont = 1 - found = 0 - is_root = 1 - while2_top: - if0 cont goto :while2_end - if current_node goto :null30 - Error("null pointer") - null30: - key_aux = call :Tree.GetKey(current_node) - t.0 = LtS(v_key key_aux) - if0 t.0 goto :if6_else - if current_node goto :null31 - Error("null pointer") - null31: - t.1 = call :Tree.GetHas_Left(current_node) - if0 t.1 goto :if7_else - parent_node = current_node - if current_node goto :null32 - Error("null pointer") - null32: - current_node = call :Tree.GetLeft(current_node) - goto :if7_end - if7_else: - cont = 0 - if7_end: - goto :if6_end - if6_else: - t.2 = LtS(key_aux v_key) - if0 t.2 goto :if8_else - if current_node goto :null33 - Error("null pointer") - null33: - t.3 = call :Tree.GetHas_Right(current_node) - if0 t.3 goto :if9_else - parent_node = current_node - if current_node goto :null34 - Error("null pointer") - null34: - current_node = call :Tree.GetRight(current_node) - goto :if9_end - if9_else: - cont = 0 - if9_end: - goto :if8_end - if8_else: - if0 is_root goto :if10_else - if current_node goto :null35 - Error("null pointer") - null35: - t.4 = call :Tree.GetHas_Right(current_node) - if t.4 goto :if11_else - if current_node goto :null36 - Error("null pointer") - null36: - t.5 = call :Tree.GetHas_Left(current_node) - if t.5 goto :if11_else - ntb = 1 - goto :if11_end - if11_else: - ntb = call :Tree.Remove(this parent_node current_node) - if11_end: - goto :if10_end - if10_else: - ntb = call :Tree.Remove(this parent_node current_node) - if10_end: - found = 1 - cont = 0 - if8_end: - if6_end: - is_root = 0 - goto :while2_top - while2_end: - ret found - -func Tree.Remove(this p_node c_node) - if c_node goto :null37 - Error("null pointer") - null37: - t.0 = call :Tree.GetHas_Left(c_node) - if0 t.0 goto :if12_else - ntb = call :Tree.RemoveLeft(this p_node c_node) - goto :if12_end - if12_else: - if c_node goto :null38 - Error("null pointer") - null38: - t.1 = call :Tree.GetHas_Right(c_node) - if0 t.1 goto :if13_else - ntb = call :Tree.RemoveRight(this p_node c_node) - goto :if13_end - if13_else: - if c_node goto :null39 - Error("null pointer") - null39: - auxkey1 = call :Tree.GetKey(c_node) - if p_node goto :null40 - Error("null pointer") - null40: - t.2 = call :Tree.GetLeft(p_node) - if t.2 goto :null41 - Error("null pointer") - null41: - auxkey2 = call :Tree.GetKey(t.2) - t.3 = call :Tree.Compare(this auxkey1 auxkey2) - if0 t.3 goto :if14_else - if p_node goto :null42 - Error("null pointer") - null42: - t.4 = [this+20] - ntb = call :Tree.SetLeft(p_node t.4) - if p_node goto :null43 - Error("null pointer") - null43: - ntb = call :Tree.SetHas_Left(p_node 0) - goto :if14_end - if14_else: - if p_node goto :null44 - Error("null pointer") - null44: - t.5 = [this+20] - ntb = call :Tree.SetRight(p_node t.5) - if p_node goto :null45 - Error("null pointer") - null45: - ntb = call :Tree.SetHas_Right(p_node 0) - if14_end: - if13_end: - if12_end: - ret 1 - -func Tree.RemoveRight(this p_node c_node) - while3_top: - if c_node goto :null46 - Error("null pointer") - null46: - t.0 = call :Tree.GetHas_Right(c_node) - if0 t.0 goto :while3_end - if c_node goto :null47 - Error("null pointer") - null47: - if c_node goto :null48 - Error("null pointer") - null48: - t.1 = call :Tree.GetRight(c_node) - if t.1 goto :null49 - Error("null pointer") - null49: - t.2 = call :Tree.GetKey(t.1) - ntb = call :Tree.SetKey(c_node t.2) - p_node = c_node - if c_node goto :null50 - Error("null pointer") - null50: - c_node = call :Tree.GetRight(c_node) - goto :while3_top - while3_end: - if p_node goto :null51 - Error("null pointer") - null51: - t.3 = [this+20] - ntb = call :Tree.SetRight(p_node t.3) - if p_node goto :null52 - Error("null pointer") - null52: - ntb = call :Tree.SetHas_Right(p_node 0) - ret 1 - -func Tree.RemoveLeft(this p_node c_node) - while4_top: - if c_node goto :null53 - Error("null pointer") - null53: - t.0 = call :Tree.GetHas_Left(c_node) - if0 t.0 goto :while4_end - if c_node goto :null54 - Error("null pointer") - null54: - if c_node goto :null55 - Error("null pointer") - null55: - t.1 = call :Tree.GetLeft(c_node) - if t.1 goto :null56 - Error("null pointer") - null56: - t.2 = call :Tree.GetKey(t.1) - ntb = call :Tree.SetKey(c_node t.2) - p_node = c_node - if c_node goto :null57 - Error("null pointer") - null57: - c_node = call :Tree.GetLeft(c_node) - goto :while4_top - while4_end: - if p_node goto :null58 - Error("null pointer") - null58: - t.3 = [this+20] - ntb = call :Tree.SetLeft(p_node t.3) - if p_node goto :null59 - Error("null pointer") - null59: - ntb = call :Tree.SetHas_Left(p_node 0) - ret 1 - -func Tree.Search(this v_key) - current_node = this - cont = 1 - ifound = 0 - while5_top: - if0 cont goto :while5_end - if current_node goto :null60 - Error("null pointer") - null60: - key_aux = call :Tree.GetKey(current_node) - t.0 = LtS(v_key key_aux) - if0 t.0 goto :if15_else - if current_node goto :null61 - Error("null pointer") - null61: - t.1 = call :Tree.GetHas_Left(current_node) - if0 t.1 goto :if16_else - if current_node goto :null62 - Error("null pointer") - null62: - current_node = call :Tree.GetLeft(current_node) - goto :if16_end - if16_else: - cont = 0 - if16_end: - goto :if15_end - if15_else: - t.2 = LtS(key_aux v_key) - if0 t.2 goto :if17_else - if current_node goto :null63 - Error("null pointer") - null63: - t.3 = call :Tree.GetHas_Right(current_node) - if0 t.3 goto :if18_else - if current_node goto :null64 - Error("null pointer") - null64: - current_node = call :Tree.GetRight(current_node) - goto :if18_end - if18_else: - cont = 0 - if18_end: - goto :if17_end - if17_else: - ifound = 1 - cont = 0 - if17_end: - if15_end: - goto :while5_top - while5_end: - ret ifound - -func Tree.Print(this) - current_node = this - ntb = call :Tree.RecPrint(this current_node) - ret 1 - -func Tree.RecPrint(this node) - if node goto :null65 - Error("null pointer") - null65: - t.0 = call :Tree.GetHas_Left(node) - if0 t.0 goto :if19_else - if node goto :null66 - Error("null pointer") - null66: - t.1 = call :Tree.GetLeft(node) - ntb = call :Tree.RecPrint(this t.1) - goto :if19_end - if19_else: - ntb = 1 - if19_end: - if node goto :null67 - Error("null pointer") - null67: - t.2 = call :Tree.GetKey(node) - PrintIntS(t.2) - if node goto :null68 - Error("null pointer") - null68: - t.3 = call :Tree.GetHas_Right(node) - if0 t.3 goto :if20_else - if node goto :null69 - Error("null pointer") - null69: - t.4 = call :Tree.GetRight(node) - ntb = call :Tree.RecPrint(this t.4) - goto :if20_end - if20_else: - ntb = 1 - if20_end: - ret 1 diff --git a/boil/tests/BinaryTree.vapor b/boil/tests/BinaryTree.vapor deleted file mode 100644 index 275cfe3..0000000 --- a/boil/tests/BinaryTree.vapor +++ /dev/null @@ -1,719 +0,0 @@ - -const vmt_BT - :BT.Start - -const vmt_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 Main() - t.0 = HeapAllocZ(4) - [t.0] = :vmt_BT - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = [t.0] - t.1 = [t.1+0] - t.2 = call t.1(t.0) - PrintIntS(t.2) - ret - -func BT.Start(this) - t.0 = HeapAllocZ(28) - [t.0] = :vmt_Tree - root = t.0 - if root goto :null2 - Error("null pointer") - null2: - t.1 = [root] - t.1 = [t.1+0] - ntb = call t.1(root 16) - if root goto :null3 - Error("null pointer") - null3: - t.2 = [root] - t.2 = [t.2+72] - ntb = call t.2(root) - PrintIntS(100000000) - if root goto :null4 - Error("null pointer") - null4: - t.3 = [root] - t.3 = [t.3+48] - ntb = call t.3(root 8) - if root goto :null5 - Error("null pointer") - null5: - t.4 = [root] - t.4 = [t.4+72] - ntb = call t.4(root) - if root goto :null6 - Error("null pointer") - null6: - t.5 = [root] - t.5 = [t.5+48] - ntb = call t.5(root 24) - if root goto :null7 - Error("null pointer") - null7: - t.6 = [root] - t.6 = [t.6+48] - ntb = call t.6(root 4) - if root goto :null8 - Error("null pointer") - null8: - t.7 = [root] - t.7 = [t.7+48] - ntb = call t.7(root 12) - if root goto :null9 - Error("null pointer") - null9: - t.8 = [root] - t.8 = [t.8+48] - ntb = call t.8(root 20) - if root goto :null10 - Error("null pointer") - null10: - t.9 = [root] - t.9 = [t.9+48] - ntb = call t.9(root 28) - if root goto :null11 - Error("null pointer") - null11: - t.10 = [root] - t.10 = [t.10+48] - ntb = call t.10(root 14) - if root goto :null12 - Error("null pointer") - null12: - t.11 = [root] - t.11 = [t.11+72] - ntb = call t.11(root) - if root goto :null13 - Error("null pointer") - null13: - t.12 = [root] - t.12 = [t.12+68] - t.13 = call t.12(root 24) - PrintIntS(t.13) - if root goto :null14 - Error("null pointer") - null14: - t.14 = [root] - t.14 = [t.14+68] - t.15 = call t.14(root 12) - PrintIntS(t.15) - if root goto :null15 - Error("null pointer") - null15: - t.16 = [root] - t.16 = [t.16+68] - t.17 = call t.16(root 16) - PrintIntS(t.17) - if root goto :null16 - Error("null pointer") - null16: - t.18 = [root] - t.18 = [t.18+68] - t.19 = call t.18(root 50) - PrintIntS(t.19) - if root goto :null17 - Error("null pointer") - null17: - t.20 = [root] - t.20 = [t.20+68] - t.21 = call t.20(root 12) - PrintIntS(t.21) - if root goto :null18 - Error("null pointer") - null18: - t.22 = [root] - t.22 = [t.22+52] - ntb = call t.22(root 12) - if root goto :null19 - Error("null pointer") - null19: - t.23 = [root] - t.23 = [t.23+72] - ntb = call t.23(root) - if root goto :null20 - Error("null pointer") - null20: - t.24 = [root] - t.24 = [t.24+68] - t.25 = call t.24(root 12) - PrintIntS(t.25) - ret 0 - -func Tree.Init(this v_key) - [this+12] = v_key - [this+16] = 0 - [this+20] = 0 - ret 1 - -func Tree.SetRight(this rn) - [this+8] = rn - ret 1 - -func Tree.SetLeft(this ln) - [this+4] = ln - ret 1 - -func Tree.GetRight(this) - t.0 = [this+8] - ret t.0 - -func Tree.GetLeft(this) - t.0 = [this+4] - ret t.0 - -func Tree.GetKey(this) - t.0 = [this+12] - ret t.0 - -func Tree.SetKey(this v_key) - [this+12] = v_key - ret 1 - -func Tree.GetHas_Right(this) - t.0 = [this+20] - ret t.0 - -func Tree.GetHas_Left(this) - t.0 = [this+16] - ret t.0 - -func Tree.SetHas_Left(this val) - [this+16] = val - ret 1 - -func Tree.SetHas_Right(this val) - [this+20] = val - ret 1 - -func Tree.Compare(this num1 num2) - ntb = 0 - nti = Add(num2 1) - t.0 = LtS(num1 num2) - if0 t.0 goto :if1_else - ntb = 0 - goto :if1_end - if1_else: - t.1 = LtS(num1 nti) - t.2 = Sub(1 t.1) - if0 t.2 goto :if2_else - ntb = 0 - goto :if2_end - if2_else: - ntb = 1 - if2_end: - if1_end: - ret ntb - -func Tree.Insert(this v_key) - t.0 = HeapAllocZ(28) - [t.0] = :vmt_Tree - new_node = t.0 - if new_node goto :null21 - Error("null pointer") - null21: - t.1 = [new_node] - t.1 = [t.1+0] - ntb = call t.1(new_node v_key) - current_node = this - cont = 1 - while1_top: - if0 cont goto :while1_end - if current_node goto :null22 - Error("null pointer") - null22: - t.2 = [current_node] - t.2 = [t.2+20] - key_aux = call t.2(current_node) - t.3 = LtS(v_key key_aux) - if0 t.3 goto :if3_else - if current_node goto :null23 - Error("null pointer") - null23: - t.4 = [current_node] - t.4 = [t.4+32] - t.5 = call t.4(current_node) - if0 t.5 goto :if4_else - if current_node goto :null24 - Error("null pointer") - null24: - t.6 = [current_node] - t.6 = [t.6+16] - current_node = call t.6(current_node) - goto :if4_end - if4_else: - cont = 0 - if current_node goto :null25 - Error("null pointer") - null25: - t.7 = [current_node] - t.7 = [t.7+36] - ntb = call t.7(current_node 1) - if current_node goto :null26 - Error("null pointer") - null26: - t.8 = [current_node] - t.8 = [t.8+8] - ntb = call t.8(current_node new_node) - if4_end: - goto :if3_end - if3_else: - if current_node goto :null27 - Error("null pointer") - null27: - t.9 = [current_node] - t.9 = [t.9+28] - t.10 = call t.9(current_node) - if0 t.10 goto :if5_else - if current_node goto :null28 - Error("null pointer") - null28: - t.11 = [current_node] - t.11 = [t.11+12] - current_node = call t.11(current_node) - goto :if5_end - if5_else: - cont = 0 - if current_node goto :null29 - Error("null pointer") - null29: - t.12 = [current_node] - t.12 = [t.12+40] - ntb = call t.12(current_node 1) - if current_node goto :null30 - Error("null pointer") - null30: - t.13 = [current_node] - t.13 = [t.13+4] - ntb = call t.13(current_node new_node) - if5_end: - if3_end: - goto :while1_top - while1_end: - ret 1 - -func Tree.Delete(this v_key) - current_node = this - parent_node = this - cont = 1 - found = 0 - is_root = 1 - while2_top: - if0 cont goto :while2_end - if current_node goto :null31 - Error("null pointer") - null31: - t.0 = [current_node] - t.0 = [t.0+20] - key_aux = call t.0(current_node) - t.1 = LtS(v_key key_aux) - if0 t.1 goto :if6_else - if current_node goto :null32 - Error("null pointer") - null32: - t.2 = [current_node] - t.2 = [t.2+32] - t.3 = call t.2(current_node) - if0 t.3 goto :if7_else - parent_node = current_node - if current_node goto :null33 - Error("null pointer") - null33: - t.4 = [current_node] - t.4 = [t.4+16] - current_node = call t.4(current_node) - goto :if7_end - if7_else: - cont = 0 - if7_end: - goto :if6_end - if6_else: - t.5 = LtS(key_aux v_key) - if0 t.5 goto :if8_else - if current_node goto :null34 - Error("null pointer") - null34: - t.6 = [current_node] - t.6 = [t.6+28] - t.7 = call t.6(current_node) - if0 t.7 goto :if9_else - parent_node = current_node - if current_node goto :null35 - Error("null pointer") - null35: - t.8 = [current_node] - t.8 = [t.8+12] - current_node = call t.8(current_node) - goto :if9_end - if9_else: - cont = 0 - if9_end: - goto :if8_end - if8_else: - if0 is_root goto :if10_else - if current_node goto :null36 - Error("null pointer") - null36: - t.10 = [current_node] - t.10 = [t.10+28] - t.11 = call t.10(current_node) - t.12 = Sub(1 t.11) - if0 t.12 goto :ss1_else - if current_node goto :null37 - Error("null pointer") - null37: - t.13 = [current_node] - t.13 = [t.13+32] - t.14 = call t.13(current_node) - t.9 = Sub(1 t.14) - goto :ss1_end - ss1_else: - t.9 = 0 - ss1_end: - if0 t.9 goto :if11_else - ntb = 1 - goto :if11_end - if11_else: - t.15 = [this] - t.15 = [t.15+56] - ntb = call t.15(this parent_node current_node) - if11_end: - goto :if10_end - if10_else: - t.16 = [this] - t.16 = [t.16+56] - ntb = call t.16(this parent_node current_node) - if10_end: - found = 1 - cont = 0 - if8_end: - if6_end: - is_root = 0 - goto :while2_top - while2_end: - ret found - -func Tree.Remove(this p_node c_node) - if c_node goto :null38 - Error("null pointer") - null38: - t.0 = [c_node] - t.0 = [t.0+32] - t.1 = call t.0(c_node) - if0 t.1 goto :if12_else - t.2 = [this] - t.2 = [t.2+64] - ntb = call t.2(this p_node c_node) - goto :if12_end - if12_else: - if c_node goto :null39 - Error("null pointer") - null39: - t.3 = [c_node] - t.3 = [t.3+28] - t.4 = call t.3(c_node) - if0 t.4 goto :if13_else - t.5 = [this] - t.5 = [t.5+60] - ntb = call t.5(this p_node c_node) - goto :if13_end - if13_else: - if c_node goto :null40 - Error("null pointer") - null40: - t.6 = [c_node] - t.6 = [t.6+20] - auxkey1 = call t.6(c_node) - if p_node goto :null41 - Error("null pointer") - null41: - t.7 = [p_node] - t.7 = [t.7+16] - t.8 = call t.7(p_node) - if t.8 goto :null42 - Error("null pointer") - null42: - t.9 = [t.8] - t.9 = [t.9+20] - auxkey2 = call t.9(t.8) - t.10 = [this] - t.10 = [t.10+44] - t.11 = call t.10(this auxkey1 auxkey2) - if0 t.11 goto :if14_else - if p_node goto :null43 - Error("null pointer") - null43: - t.12 = [p_node] - t.12 = [t.12+8] - t.13 = [this+24] - ntb = call t.12(p_node t.13) - if p_node goto :null44 - Error("null pointer") - null44: - t.14 = [p_node] - t.14 = [t.14+36] - ntb = call t.14(p_node 0) - goto :if14_end - if14_else: - if p_node goto :null45 - Error("null pointer") - null45: - t.15 = [p_node] - t.15 = [t.15+4] - t.16 = [this+24] - ntb = call t.15(p_node t.16) - if p_node goto :null46 - Error("null pointer") - null46: - t.17 = [p_node] - t.17 = [t.17+40] - ntb = call t.17(p_node 0) - if14_end: - if13_end: - if12_end: - ret 1 - -func Tree.RemoveRight(this p_node c_node) - while3_top: - if c_node goto :null47 - Error("null pointer") - null47: - t.0 = [c_node] - t.0 = [t.0+28] - t.1 = call t.0(c_node) - if0 t.1 goto :while3_end - if c_node goto :null48 - Error("null pointer") - null48: - t.2 = [c_node] - t.2 = [t.2+24] - if c_node goto :null49 - Error("null pointer") - null49: - t.3 = [c_node] - t.3 = [t.3+12] - t.4 = call t.3(c_node) - if t.4 goto :null50 - Error("null pointer") - null50: - t.5 = [t.4] - t.5 = [t.5+20] - t.6 = call t.5(t.4) - ntb = call t.2(c_node t.6) - p_node = c_node - if c_node goto :null51 - Error("null pointer") - null51: - t.7 = [c_node] - t.7 = [t.7+12] - c_node = call t.7(c_node) - goto :while3_top - while3_end: - if p_node goto :null52 - Error("null pointer") - null52: - t.8 = [p_node] - t.8 = [t.8+4] - t.9 = [this+24] - ntb = call t.8(p_node t.9) - if p_node goto :null53 - Error("null pointer") - null53: - t.10 = [p_node] - t.10 = [t.10+40] - ntb = call t.10(p_node 0) - ret 1 - -func Tree.RemoveLeft(this p_node c_node) - while4_top: - if c_node goto :null54 - Error("null pointer") - null54: - t.0 = [c_node] - t.0 = [t.0+32] - t.1 = call t.0(c_node) - if0 t.1 goto :while4_end - if c_node goto :null55 - Error("null pointer") - null55: - t.2 = [c_node] - t.2 = [t.2+24] - if c_node goto :null56 - Error("null pointer") - null56: - t.3 = [c_node] - t.3 = [t.3+16] - t.4 = call t.3(c_node) - if t.4 goto :null57 - Error("null pointer") - null57: - t.5 = [t.4] - t.5 = [t.5+20] - t.6 = call t.5(t.4) - ntb = call t.2(c_node t.6) - p_node = c_node - if c_node goto :null58 - Error("null pointer") - null58: - t.7 = [c_node] - t.7 = [t.7+16] - c_node = call t.7(c_node) - goto :while4_top - while4_end: - if p_node goto :null59 - Error("null pointer") - null59: - t.8 = [p_node] - t.8 = [t.8+8] - t.9 = [this+24] - ntb = call t.8(p_node t.9) - if p_node goto :null60 - Error("null pointer") - null60: - t.10 = [p_node] - t.10 = [t.10+36] - ntb = call t.10(p_node 0) - ret 1 - -func Tree.Search(this v_key) - current_node = this - cont = 1 - ifound = 0 - while5_top: - if0 cont goto :while5_end - if current_node goto :null61 - Error("null pointer") - null61: - t.0 = [current_node] - t.0 = [t.0+20] - key_aux = call t.0(current_node) - t.1 = LtS(v_key key_aux) - if0 t.1 goto :if15_else - if current_node goto :null62 - Error("null pointer") - null62: - t.2 = [current_node] - t.2 = [t.2+32] - t.3 = call t.2(current_node) - if0 t.3 goto :if16_else - if current_node goto :null63 - Error("null pointer") - null63: - t.4 = [current_node] - t.4 = [t.4+16] - current_node = call t.4(current_node) - goto :if16_end - if16_else: - cont = 0 - if16_end: - goto :if15_end - if15_else: - t.5 = LtS(key_aux v_key) - if0 t.5 goto :if17_else - if current_node goto :null64 - Error("null pointer") - null64: - t.6 = [current_node] - t.6 = [t.6+28] - t.7 = call t.6(current_node) - if0 t.7 goto :if18_else - if current_node goto :null65 - Error("null pointer") - null65: - t.8 = [current_node] - t.8 = [t.8+12] - current_node = call t.8(current_node) - goto :if18_end - if18_else: - cont = 0 - if18_end: - goto :if17_end - if17_else: - ifound = 1 - cont = 0 - if17_end: - if15_end: - goto :while5_top - while5_end: - ret ifound - -func Tree.Print(this) - current_node = this - t.0 = [this] - t.0 = [t.0+76] - ntb = call t.0(this current_node) - ret 1 - -func Tree.RecPrint(this node) - if node goto :null66 - Error("null pointer") - null66: - t.0 = [node] - t.0 = [t.0+32] - t.1 = call t.0(node) - if0 t.1 goto :if19_else - t.2 = [this] - t.2 = [t.2+76] - if node goto :null67 - Error("null pointer") - null67: - t.3 = [node] - t.3 = [t.3+16] - t.4 = call t.3(node) - ntb = call t.2(this t.4) - goto :if19_end - if19_else: - ntb = 1 - if19_end: - if node goto :null68 - Error("null pointer") - null68: - t.5 = [node] - t.5 = [t.5+20] - t.6 = call t.5(node) - PrintIntS(t.6) - if node goto :null69 - Error("null pointer") - null69: - t.7 = [node] - t.7 = [t.7+28] - t.8 = call t.7(node) - if0 t.8 goto :if20_else - t.9 = [this] - t.9 = [t.9+76] - if node goto :null70 - Error("null pointer") - null70: - t.10 = [node] - t.10 = [t.10+12] - t.11 = call t.10(node) - ntb = call t.9(this t.11) - goto :if20_end - if20_else: - ntb = 1 - if20_end: - ret 1 diff --git a/boil/tests/BubbleSort.opt.vapor b/boil/tests/BubbleSort.opt.vapor deleted file mode 100644 index a118894..0000000 --- a/boil/tests/BubbleSort.opt.vapor +++ /dev/null @@ -1,277 +0,0 @@ - -const empty_BBS - - -func Main() - t.0 = HeapAllocZ(8) - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = call :BBS.Start(t.0 10) - PrintIntS(t.1) - ret - -func BBS.Start(this sz) - aux01 = call :BBS.Init(this sz) - aux01 = call :BBS.Print(this) - PrintIntS(99999) - aux01 = call :BBS.Sort(this) - aux01 = call :BBS.Print(this) - ret 0 - -func BBS.Sort(this) - t.0 = [this+4] - i = Sub(t.0 1) - aux02 = Sub(0 1) - while1_top: - t.1 = LtS(aux02 i) - if0 t.1 goto :while1_end - j = 1 - while2_top: - t.2 = Add(i 1) - t.3 = LtS(j t.2) - if0 t.3 goto :while2_end - aux07 = Sub(j 1) - t.4 = [this+0] - if t.4 goto :null2 - Error("null pointer") - null2: - t.5 = [t.4] - t.5 = Lt(aux07 t.5) - if t.5 goto :bounds1 - Error("array index out of bounds") - bounds1: - t.5 = MulS(aux07 4) - t.5 = Add(t.5 t.4) - aux04 = [t.5+4] - t.6 = [this+0] - if t.6 goto :null3 - Error("null pointer") - null3: - t.7 = [t.6] - t.7 = Lt(j t.7) - if t.7 goto :bounds2 - Error("array index out of bounds") - bounds2: - t.7 = MulS(j 4) - t.7 = Add(t.7 t.6) - aux05 = [t.7+4] - t.8 = LtS(aux05 aux04) - if0 t.8 goto :if1_else - aux06 = Sub(j 1) - t.9 = [this+0] - if t.9 goto :null4 - Error("null pointer") - null4: - t.10 = [t.9] - t.10 = Lt(aux06 t.10) - if t.10 goto :bounds3 - Error("array index out of bounds") - bounds3: - t.10 = MulS(aux06 4) - t.10 = Add(t.10 t.9) - t = [t.10+4] - t.11 = [this+0] - if t.11 goto :null5 - Error("null pointer") - null5: - t.12 = [t.11] - t.12 = Lt(aux06 t.12) - if t.12 goto :bounds4 - Error("array index out of bounds") - bounds4: - t.12 = MulS(aux06 4) - t.12 = Add(t.12 t.11) - t.13 = [this+0] - if t.13 goto :null6 - Error("null pointer") - null6: - t.14 = [t.13] - t.14 = Lt(j t.14) - if t.14 goto :bounds5 - Error("array index out of bounds") - bounds5: - t.14 = MulS(j 4) - t.14 = Add(t.14 t.13) - t.15 = [t.14+4] - [t.12+4] = t.15 - t.16 = [this+0] - if t.16 goto :null7 - Error("null pointer") - null7: - t.17 = [t.16] - t.17 = Lt(j t.17) - if t.17 goto :bounds6 - Error("array index out of bounds") - bounds6: - t.17 = MulS(j 4) - t.17 = Add(t.17 t.16) - [t.17+4] = t - goto :if1_end - if1_else: - nt = 0 - if1_end: - j = Add(j 1) - goto :while2_top - while2_end: - i = Sub(i 1) - goto :while1_top - while1_end: - ret 0 - -func BBS.Print(this) - j = 0 - while3_top: - t.0 = [this+4] - t.1 = LtS(j t.0) - if0 t.1 goto :while3_end - t.2 = [this+0] - if t.2 goto :null8 - Error("null pointer") - null8: - t.3 = [t.2] - t.3 = Lt(j t.3) - if t.3 goto :bounds7 - Error("array index out of bounds") - bounds7: - t.3 = MulS(j 4) - t.3 = Add(t.3 t.2) - t.4 = [t.3+4] - PrintIntS(t.4) - j = Add(j 1) - goto :while3_top - while3_end: - ret 0 - -func BBS.Init(this sz) - [this+4] = sz - t.0 = call :AllocArray(sz) - [this+0] = t.0 - t.1 = [this+0] - if t.1 goto :null9 - Error("null pointer") - null9: - t.2 = [t.1] - t.2 = Lt(0 t.2) - if t.2 goto :bounds8 - Error("array index out of bounds") - bounds8: - t.2 = MulS(0 4) - t.2 = Add(t.2 t.1) - [t.2+4] = 20 - t.3 = [this+0] - if t.3 goto :null10 - Error("null pointer") - null10: - t.4 = [t.3] - t.4 = Lt(1 t.4) - if t.4 goto :bounds9 - Error("array index out of bounds") - bounds9: - t.4 = MulS(1 4) - t.4 = Add(t.4 t.3) - [t.4+4] = 7 - t.5 = [this+0] - if t.5 goto :null11 - Error("null pointer") - null11: - t.6 = [t.5] - t.6 = Lt(2 t.6) - if t.6 goto :bounds10 - Error("array index out of bounds") - bounds10: - t.6 = MulS(2 4) - t.6 = Add(t.6 t.5) - [t.6+4] = 12 - t.7 = [this+0] - if t.7 goto :null12 - Error("null pointer") - null12: - t.8 = [t.7] - t.8 = Lt(3 t.8) - if t.8 goto :bounds11 - Error("array index out of bounds") - bounds11: - t.8 = MulS(3 4) - t.8 = Add(t.8 t.7) - [t.8+4] = 18 - t.9 = [this+0] - if t.9 goto :null13 - Error("null pointer") - null13: - t.10 = [t.9] - t.10 = Lt(4 t.10) - if t.10 goto :bounds12 - Error("array index out of bounds") - bounds12: - t.10 = MulS(4 4) - t.10 = Add(t.10 t.9) - [t.10+4] = 2 - t.11 = [this+0] - if t.11 goto :null14 - Error("null pointer") - null14: - t.12 = [t.11] - t.12 = Lt(5 t.12) - if t.12 goto :bounds13 - Error("array index out of bounds") - bounds13: - t.12 = MulS(5 4) - t.12 = Add(t.12 t.11) - [t.12+4] = 11 - t.13 = [this+0] - if t.13 goto :null15 - Error("null pointer") - null15: - t.14 = [t.13] - t.14 = Lt(6 t.14) - if t.14 goto :bounds14 - Error("array index out of bounds") - bounds14: - t.14 = MulS(6 4) - t.14 = Add(t.14 t.13) - [t.14+4] = 6 - t.15 = [this+0] - if t.15 goto :null16 - Error("null pointer") - null16: - t.16 = [t.15] - t.16 = Lt(7 t.16) - if t.16 goto :bounds15 - Error("array index out of bounds") - bounds15: - t.16 = MulS(7 4) - t.16 = Add(t.16 t.15) - [t.16+4] = 9 - t.17 = [this+0] - if t.17 goto :null17 - Error("null pointer") - null17: - t.18 = [t.17] - t.18 = Lt(8 t.18) - if t.18 goto :bounds16 - Error("array index out of bounds") - bounds16: - t.18 = MulS(8 4) - t.18 = Add(t.18 t.17) - [t.18+4] = 19 - t.19 = [this+0] - if t.19 goto :null18 - Error("null pointer") - null18: - t.20 = [t.19] - t.20 = Lt(9 t.20) - if t.20 goto :bounds17 - Error("array index out of bounds") - bounds17: - t.20 = MulS(9 4) - t.20 = Add(t.20 t.19) - [t.20+4] = 5 - ret 0 - -func AllocArray(size) - bytes = MulS(size 4) - bytes = Add(bytes 4) - v = HeapAllocZ(bytes) - [v] = size - ret v diff --git a/boil/tests/BubbleSort.vapor b/boil/tests/BubbleSort.vapor deleted file mode 100644 index cedba69..0000000 --- a/boil/tests/BubbleSort.vapor +++ /dev/null @@ -1,292 +0,0 @@ - -const vmt_BBS - :BBS.Start - :BBS.Sort - :BBS.Print - :BBS.Init - - -func Main() - t.0 = HeapAllocZ(12) - [t.0] = :vmt_BBS - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = [t.0] - t.1 = [t.1+0] - t.2 = call t.1(t.0 10) - PrintIntS(t.2) - ret - -func BBS.Start(this sz) - t.0 = [this] - t.0 = [t.0+12] - aux01 = call t.0(this sz) - t.1 = [this] - t.1 = [t.1+8] - aux01 = call t.1(this) - PrintIntS(99999) - t.2 = [this] - t.2 = [t.2+4] - aux01 = call t.2(this) - t.3 = [this] - t.3 = [t.3+8] - aux01 = call t.3(this) - ret 0 - -func BBS.Sort(this) - t.0 = [this+8] - i = Sub(t.0 1) - aux02 = Sub(0 1) - while1_top: - t.1 = LtS(aux02 i) - if0 t.1 goto :while1_end - j = 1 - while2_top: - t.2 = Add(i 1) - t.3 = LtS(j t.2) - if0 t.3 goto :while2_end - aux07 = Sub(j 1) - t.4 = [this+4] - if t.4 goto :null2 - Error("null pointer") - null2: - t.5 = [t.4] - t.5 = Lt(aux07 t.5) - if t.5 goto :bounds1 - Error("array index out of bounds") - bounds1: - t.5 = MulS(aux07 4) - t.5 = Add(t.5 t.4) - aux04 = [t.5+4] - t.6 = [this+4] - if t.6 goto :null3 - Error("null pointer") - null3: - t.7 = [t.6] - t.7 = Lt(j t.7) - if t.7 goto :bounds2 - Error("array index out of bounds") - bounds2: - t.7 = MulS(j 4) - t.7 = Add(t.7 t.6) - aux05 = [t.7+4] - t.8 = LtS(aux05 aux04) - if0 t.8 goto :if1_else - aux06 = Sub(j 1) - t.9 = [this+4] - if t.9 goto :null4 - Error("null pointer") - null4: - t.10 = [t.9] - t.10 = Lt(aux06 t.10) - if t.10 goto :bounds3 - Error("array index out of bounds") - bounds3: - t.10 = MulS(aux06 4) - t.10 = Add(t.10 t.9) - t = [t.10+4] - t.11 = [this+4] - if t.11 goto :null5 - Error("null pointer") - null5: - t.12 = [t.11] - t.12 = Lt(aux06 t.12) - if t.12 goto :bounds4 - Error("array index out of bounds") - bounds4: - t.12 = MulS(aux06 4) - t.12 = Add(t.12 t.11) - t.13 = [this+4] - if t.13 goto :null6 - Error("null pointer") - null6: - t.14 = [t.13] - t.14 = Lt(j t.14) - if t.14 goto :bounds5 - Error("array index out of bounds") - bounds5: - t.14 = MulS(j 4) - t.14 = Add(t.14 t.13) - t.15 = [t.14+4] - [t.12+4] = t.15 - t.16 = [this+4] - if t.16 goto :null7 - Error("null pointer") - null7: - t.17 = [t.16] - t.17 = Lt(j t.17) - if t.17 goto :bounds6 - Error("array index out of bounds") - bounds6: - t.17 = MulS(j 4) - t.17 = Add(t.17 t.16) - [t.17+4] = t - goto :if1_end - if1_else: - nt = 0 - if1_end: - j = Add(j 1) - goto :while2_top - while2_end: - i = Sub(i 1) - goto :while1_top - while1_end: - ret 0 - -func BBS.Print(this) - j = 0 - while3_top: - t.0 = [this+8] - t.1 = LtS(j t.0) - if0 t.1 goto :while3_end - t.2 = [this+4] - if t.2 goto :null8 - Error("null pointer") - null8: - t.3 = [t.2] - t.3 = Lt(j t.3) - if t.3 goto :bounds7 - Error("array index out of bounds") - bounds7: - t.3 = MulS(j 4) - t.3 = Add(t.3 t.2) - t.4 = [t.3+4] - PrintIntS(t.4) - j = Add(j 1) - goto :while3_top - while3_end: - ret 0 - -func BBS.Init(this sz) - [this+8] = sz - t.0 = call :AllocArray(sz) - [this+4] = t.0 - t.1 = [this+4] - if t.1 goto :null9 - Error("null pointer") - null9: - t.2 = [t.1] - t.2 = Lt(0 t.2) - if t.2 goto :bounds8 - Error("array index out of bounds") - bounds8: - t.2 = MulS(0 4) - t.2 = Add(t.2 t.1) - [t.2+4] = 20 - t.3 = [this+4] - if t.3 goto :null10 - Error("null pointer") - null10: - t.4 = [t.3] - t.4 = Lt(1 t.4) - if t.4 goto :bounds9 - Error("array index out of bounds") - bounds9: - t.4 = MulS(1 4) - t.4 = Add(t.4 t.3) - [t.4+4] = 7 - t.5 = [this+4] - if t.5 goto :null11 - Error("null pointer") - null11: - t.6 = [t.5] - t.6 = Lt(2 t.6) - if t.6 goto :bounds10 - Error("array index out of bounds") - bounds10: - t.6 = MulS(2 4) - t.6 = Add(t.6 t.5) - [t.6+4] = 12 - t.7 = [this+4] - if t.7 goto :null12 - Error("null pointer") - null12: - t.8 = [t.7] - t.8 = Lt(3 t.8) - if t.8 goto :bounds11 - Error("array index out of bounds") - bounds11: - t.8 = MulS(3 4) - t.8 = Add(t.8 t.7) - [t.8+4] = 18 - t.9 = [this+4] - if t.9 goto :null13 - Error("null pointer") - null13: - t.10 = [t.9] - t.10 = Lt(4 t.10) - if t.10 goto :bounds12 - Error("array index out of bounds") - bounds12: - t.10 = MulS(4 4) - t.10 = Add(t.10 t.9) - [t.10+4] = 2 - t.11 = [this+4] - if t.11 goto :null14 - Error("null pointer") - null14: - t.12 = [t.11] - t.12 = Lt(5 t.12) - if t.12 goto :bounds13 - Error("array index out of bounds") - bounds13: - t.12 = MulS(5 4) - t.12 = Add(t.12 t.11) - [t.12+4] = 11 - t.13 = [this+4] - if t.13 goto :null15 - Error("null pointer") - null15: - t.14 = [t.13] - t.14 = Lt(6 t.14) - if t.14 goto :bounds14 - Error("array index out of bounds") - bounds14: - t.14 = MulS(6 4) - t.14 = Add(t.14 t.13) - [t.14+4] = 6 - t.15 = [this+4] - if t.15 goto :null16 - Error("null pointer") - null16: - t.16 = [t.15] - t.16 = Lt(7 t.16) - if t.16 goto :bounds15 - Error("array index out of bounds") - bounds15: - t.16 = MulS(7 4) - t.16 = Add(t.16 t.15) - [t.16+4] = 9 - t.17 = [this+4] - if t.17 goto :null17 - Error("null pointer") - null17: - t.18 = [t.17] - t.18 = Lt(8 t.18) - if t.18 goto :bounds16 - Error("array index out of bounds") - bounds16: - t.18 = MulS(8 4) - t.18 = Add(t.18 t.17) - [t.18+4] = 19 - t.19 = [this+4] - if t.19 goto :null18 - Error("null pointer") - null18: - t.20 = [t.19] - t.20 = Lt(9 t.20) - if t.20 goto :bounds17 - Error("array index out of bounds") - bounds17: - t.20 = MulS(9 4) - t.20 = Add(t.20 t.19) - [t.20+4] = 5 - ret 0 - -func AllocArray(size) - bytes = MulS(size 4) - bytes = Add(bytes 4) - v = HeapAllocZ(bytes) - [v] = size - ret v diff --git a/boil/tests/Factorial.opt.vapor b/boil/tests/Factorial.opt.vapor deleted file mode 100644 index aca17fe..0000000 --- a/boil/tests/Factorial.opt.vapor +++ /dev/null @@ -1,20 +0,0 @@ - -const empty_Fac - - -func Main() - t.0 = call :Fac.ComputeFac(:empty_Fac 10) - PrintIntS(t.0) - ret - -func Fac.ComputeFac(this num) - t.0 = LtS(num 1) - if0 t.0 goto :if1_else - num_aux = 1 - goto :if1_end - if1_else: - t.1 = Sub(num 1) - t.2 = call :Fac.ComputeFac(this t.1) - num_aux = MulS(num t.2) - if1_end: - ret num_aux diff --git a/boil/tests/Factorial.vapor b/boil/tests/Factorial.vapor deleted file mode 100644 index 28e1126..0000000 --- a/boil/tests/Factorial.vapor +++ /dev/null @@ -1,30 +0,0 @@ - -const vmt_Fac - :Fac.ComputeFac - - -func Main() - t.0 = HeapAllocZ(4) - [t.0] = :vmt_Fac - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = [t.0] - t.1 = [t.1+0] - t.2 = call t.1(t.0 10) - PrintIntS(t.2) - ret - -func Fac.ComputeFac(this num) - t.0 = LtS(num 1) - if0 t.0 goto :if1_else - num_aux = 1 - goto :if1_end - if1_else: - t.1 = [this] - t.1 = [t.1+0] - t.2 = Sub(num 1) - t.3 = call t.1(this t.2) - num_aux = MulS(num t.3) - if1_end: - ret num_aux diff --git a/boil/tests/LinearSearch.opt.vapor b/boil/tests/LinearSearch.opt.vapor deleted file mode 100644 index 302de05..0000000 --- a/boil/tests/LinearSearch.opt.vapor +++ /dev/null @@ -1,130 +0,0 @@ - -const empty_LS - - -func Main() - t.0 = HeapAllocZ(8) - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = call :LS.Start(t.0 10) - PrintIntS(t.1) - ret - -func LS.Start(this sz) - aux01 = call :LS.Init(this sz) - aux02 = call :LS.Print(this) - PrintIntS(9999) - t.0 = call :LS.Search(this 8) - PrintIntS(t.0) - t.1 = call :LS.Search(this 12) - PrintIntS(t.1) - t.2 = call :LS.Search(this 17) - PrintIntS(t.2) - t.3 = call :LS.Search(this 50) - PrintIntS(t.3) - ret 55 - -func LS.Print(this) - j = 1 - while1_top: - t.0 = [this+4] - t.1 = LtS(j t.0) - if0 t.1 goto :while1_end - t.2 = [this+0] - if t.2 goto :null2 - Error("null pointer") - null2: - t.3 = [t.2] - t.3 = Lt(j t.3) - if t.3 goto :bounds1 - Error("array index out of bounds") - bounds1: - t.3 = MulS(j 4) - t.3 = Add(t.3 t.2) - t.4 = [t.3+4] - PrintIntS(t.4) - j = Add(j 1) - goto :while1_top - while1_end: - ret 0 - -func LS.Search(this num) - j = 1 - ls01 = 0 - ifound = 0 - while2_top: - t.0 = [this+4] - t.1 = LtS(j t.0) - if0 t.1 goto :while2_end - t.2 = [this+0] - if t.2 goto :null3 - Error("null pointer") - null3: - t.3 = [t.2] - t.3 = Lt(j t.3) - if t.3 goto :bounds2 - Error("array index out of bounds") - bounds2: - t.3 = MulS(j 4) - t.3 = Add(t.3 t.2) - aux01 = [t.3+4] - aux02 = Add(num 1) - t.4 = LtS(aux01 num) - if0 t.4 goto :if1_else - nt = 0 - goto :if1_end - if1_else: - t.5 = LtS(aux01 aux02) - if t.5 goto :if2_else - nt = 0 - goto :if2_end - if2_else: - ls01 = 1 - ifound = 1 - j = [this+4] - if2_end: - if1_end: - j = Add(j 1) - goto :while2_top - while2_end: - ret ifound - -func LS.Init(this sz) - [this+4] = sz - t.0 = call :AllocArray(sz) - [this+0] = t.0 - j = 1 - t.1 = [this+4] - k = Add(t.1 1) - while3_top: - t.2 = [this+4] - t.3 = LtS(j t.2) - if0 t.3 goto :while3_end - aux01 = MulS(2 j) - aux02 = Sub(k 3) - t.4 = [this+0] - if t.4 goto :null4 - Error("null pointer") - null4: - t.5 = [t.4] - t.5 = Lt(j t.5) - if t.5 goto :bounds3 - Error("array index out of bounds") - bounds3: - t.5 = MulS(j 4) - t.5 = Add(t.5 t.4) - t.6 = Add(aux01 aux02) - [t.5+4] = t.6 - j = Add(j 1) - k = Sub(k 1) - goto :while3_top - while3_end: - ret 0 - -func AllocArray(size) - bytes = MulS(size 4) - bytes = Add(bytes 4) - v = HeapAllocZ(bytes) - [v] = size - ret v diff --git a/boil/tests/LinearSearch.vapor b/boil/tests/LinearSearch.vapor deleted file mode 100644 index db4884a..0000000 --- a/boil/tests/LinearSearch.vapor +++ /dev/null @@ -1,150 +0,0 @@ - -const vmt_LS - :LS.Start - :LS.Print - :LS.Search - :LS.Init - - -func Main() - t.0 = HeapAllocZ(12) - [t.0] = :vmt_LS - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = [t.0] - t.1 = [t.1+0] - t.2 = call t.1(t.0 10) - PrintIntS(t.2) - ret - -func LS.Start(this sz) - t.0 = [this] - t.0 = [t.0+12] - aux01 = call t.0(this sz) - t.1 = [this] - t.1 = [t.1+4] - aux02 = call t.1(this) - PrintIntS(9999) - t.2 = [this] - t.2 = [t.2+8] - t.3 = call t.2(this 8) - PrintIntS(t.3) - t.4 = [this] - t.4 = [t.4+8] - t.5 = call t.4(this 12) - PrintIntS(t.5) - t.6 = [this] - t.6 = [t.6+8] - t.7 = call t.6(this 17) - PrintIntS(t.7) - t.8 = [this] - t.8 = [t.8+8] - t.9 = call t.8(this 50) - PrintIntS(t.9) - ret 55 - -func LS.Print(this) - j = 1 - while1_top: - t.0 = [this+8] - t.1 = LtS(j t.0) - if0 t.1 goto :while1_end - t.2 = [this+4] - if t.2 goto :null2 - Error("null pointer") - null2: - t.3 = [t.2] - t.3 = Lt(j t.3) - if t.3 goto :bounds1 - Error("array index out of bounds") - bounds1: - t.3 = MulS(j 4) - t.3 = Add(t.3 t.2) - t.4 = [t.3+4] - PrintIntS(t.4) - j = Add(j 1) - goto :while1_top - while1_end: - ret 0 - -func LS.Search(this num) - j = 1 - ls01 = 0 - ifound = 0 - while2_top: - t.0 = [this+8] - t.1 = LtS(j t.0) - if0 t.1 goto :while2_end - t.2 = [this+4] - if t.2 goto :null3 - Error("null pointer") - null3: - t.3 = [t.2] - t.3 = Lt(j t.3) - if t.3 goto :bounds2 - Error("array index out of bounds") - bounds2: - t.3 = MulS(j 4) - t.3 = Add(t.3 t.2) - aux01 = [t.3+4] - aux02 = Add(num 1) - t.4 = LtS(aux01 num) - if0 t.4 goto :if1_else - nt = 0 - goto :if1_end - if1_else: - t.5 = LtS(aux01 aux02) - t.6 = Sub(1 t.5) - if0 t.6 goto :if2_else - nt = 0 - goto :if2_end - if2_else: - ls01 = 1 - ifound = 1 - j = [this+8] - if2_end: - if1_end: - j = Add(j 1) - goto :while2_top - while2_end: - ret ifound - -func LS.Init(this sz) - [this+8] = sz - t.0 = call :AllocArray(sz) - [this+4] = t.0 - j = 1 - t.1 = [this+8] - k = Add(t.1 1) - while3_top: - t.2 = [this+8] - t.3 = LtS(j t.2) - if0 t.3 goto :while3_end - aux01 = MulS(2 j) - aux02 = Sub(k 3) - t.4 = [this+4] - if t.4 goto :null4 - Error("null pointer") - null4: - t.5 = [t.4] - t.5 = Lt(j t.5) - if t.5 goto :bounds3 - Error("array index out of bounds") - bounds3: - t.5 = MulS(j 4) - t.5 = Add(t.5 t.4) - t.6 = Add(aux01 aux02) - [t.5+4] = t.6 - j = Add(j 1) - k = Sub(k 1) - goto :while3_top - while3_end: - ret 0 - -func AllocArray(size) - bytes = MulS(size 4) - bytes = Add(bytes 4) - v = HeapAllocZ(bytes) - [v] = size - ret v diff --git a/boil/tests/LinkedList.opt.vapor b/boil/tests/LinkedList.opt.vapor deleted file mode 100644 index aaca62c..0000000 --- a/boil/tests/LinkedList.opt.vapor +++ /dev/null @@ -1,373 +0,0 @@ - -const empty_Element - -const empty_List - -const empty_LL - - -func Main() - t.0 = call :LL.Start(:empty_LL) - PrintIntS(t.0) - ret - -func Element.Init(this v_Age v_Salary v_Married) - [this+0] = v_Age - [this+4] = v_Salary - [this+8] = v_Married - ret 1 - -func Element.GetAge(this) - t.0 = [this+0] - ret t.0 - -func Element.GetSalary(this) - t.0 = [this+4] - ret t.0 - -func Element.GetMarried(this) - t.0 = [this+8] - ret t.0 - -func Element.Equal(this other) - ret_val = 1 - if other goto :null1 - Error("null pointer") - null1: - aux01 = call :Element.GetAge(other) - t.0 = [this+0] - t.1 = call :Element.Compare(this aux01 t.0) - if t.1 goto :if1_else - ret_val = 0 - goto :if1_end - if1_else: - if other goto :null2 - Error("null pointer") - null2: - aux02 = call :Element.GetSalary(other) - t.2 = [this+4] - t.3 = call :Element.Compare(this aux02 t.2) - if t.3 goto :if2_else - ret_val = 0 - goto :if2_end - if2_else: - t.4 = [this+8] - if0 t.4 goto :if3_else - if other goto :null3 - Error("null pointer") - null3: - t.5 = call :Element.GetMarried(other) - if t.5 goto :if4_else - ret_val = 0 - goto :if4_end - if4_else: - nt = 0 - if4_end: - goto :if3_end - if3_else: - if other goto :null4 - Error("null pointer") - null4: - t.6 = call :Element.GetMarried(other) - if0 t.6 goto :if5_else - ret_val = 0 - goto :if5_end - if5_else: - nt = 0 - if5_end: - if3_end: - if2_end: - if1_end: - ret ret_val - -func Element.Compare(this num1 num2) - retval = 0 - aux02 = Add(num2 1) - t.0 = LtS(num1 num2) - if0 t.0 goto :if6_else - retval = 0 - goto :if6_end - if6_else: - t.1 = LtS(num1 aux02) - if t.1 goto :if7_else - retval = 0 - goto :if7_end - if7_else: - retval = 1 - if7_end: - if6_end: - ret retval - -func List.Init(this) - [this+8] = 1 - ret 1 - -func List.InitNew(this v_elem v_next v_end) - [this+8] = v_end - [this+0] = v_elem - [this+4] = v_next - ret 1 - -func List.Insert(this new_elem) - aux03 = this - aux02 = HeapAllocZ(12) - if aux02 goto :null5 - Error("null pointer") - null5: - ret_val = call :List.InitNew(aux02 new_elem aux03 0) - ret aux02 - -func List.SetNext(this v_next) - [this+4] = v_next - ret 1 - -func List.Delete(this e) - my_head = this - ret_val = 0 - aux04 = Sub(0 1) - aux01 = this - prev = this - var_end = [this+8] - var_elem = [this+0] - while1_top: - if var_end goto :ss1_else - t.0 = Sub(1 ret_val) - goto :ss1_end - ss1_else: - t.0 = 0 - ss1_end: - if0 t.0 goto :while1_end - if e goto :null6 - Error("null pointer") - null6: - t.1 = call :Element.Equal(e var_elem) - if0 t.1 goto :if8_else - ret_val = 1 - t.2 = LtS(aux04 0) - if0 t.2 goto :if9_else - if aux01 goto :null7 - Error("null pointer") - null7: - my_head = call :List.GetNext(aux01) - goto :if9_end - if9_else: - t.3 = Sub(0 555) - PrintIntS(t.3) - if prev goto :null8 - Error("null pointer") - null8: - if aux01 goto :null9 - Error("null pointer") - null9: - t.4 = call :List.GetNext(aux01) - aux05 = call :List.SetNext(prev t.4) - t.5 = Sub(0 555) - PrintIntS(t.5) - if9_end: - goto :if8_end - if8_else: - nt = 0 - if8_end: - if ret_val goto :if10_else - prev = aux01 - if aux01 goto :null10 - Error("null pointer") - null10: - aux01 = call :List.GetNext(aux01) - if aux01 goto :null11 - Error("null pointer") - null11: - var_end = call :List.GetEnd(aux01) - if aux01 goto :null12 - Error("null pointer") - null12: - var_elem = call :List.GetElem(aux01) - aux04 = 1 - goto :if10_end - if10_else: - nt = 0 - if10_end: - goto :while1_top - while1_end: - ret my_head - -func List.Search(this e) - int_ret_val = 0 - aux01 = this - var_end = [this+8] - var_elem = [this+0] - while2_top: - t.0 = Sub(1 var_end) - if0 t.0 goto :while2_end - if e goto :null13 - Error("null pointer") - null13: - t.1 = call :Element.Equal(e var_elem) - if0 t.1 goto :if11_else - int_ret_val = 1 - goto :if11_end - if11_else: - nt = 0 - if11_end: - if aux01 goto :null14 - Error("null pointer") - null14: - aux01 = call :List.GetNext(aux01) - if aux01 goto :null15 - Error("null pointer") - null15: - var_end = call :List.GetEnd(aux01) - if aux01 goto :null16 - Error("null pointer") - null16: - var_elem = call :List.GetElem(aux01) - goto :while2_top - while2_end: - ret int_ret_val - -func List.GetEnd(this) - t.0 = [this+8] - ret t.0 - -func List.GetElem(this) - t.0 = [this+0] - ret t.0 - -func List.GetNext(this) - t.0 = [this+4] - ret t.0 - -func List.Print(this) - aux01 = this - var_end = [this+8] - var_elem = [this+0] - while3_top: - t.0 = Sub(1 var_end) - if0 t.0 goto :while3_end - if var_elem goto :null17 - Error("null pointer") - null17: - t.1 = call :Element.GetAge(var_elem) - PrintIntS(t.1) - if aux01 goto :null18 - Error("null pointer") - null18: - aux01 = call :List.GetNext(aux01) - if aux01 goto :null19 - Error("null pointer") - null19: - var_end = call :List.GetEnd(aux01) - if aux01 goto :null20 - Error("null pointer") - null20: - var_elem = call :List.GetElem(aux01) - goto :while3_top - while3_end: - ret 1 - -func LL.Start(this) - last_elem = HeapAllocZ(12) - if last_elem goto :null21 - Error("null pointer") - null21: - aux01 = call :List.Init(last_elem) - head = last_elem - if head goto :null22 - Error("null pointer") - null22: - aux01 = call :List.Init(head) - if head goto :null23 - Error("null pointer") - null23: - aux01 = call :List.Print(head) - el01 = HeapAllocZ(12) - if el01 goto :null24 - Error("null pointer") - null24: - aux01 = call :Element.Init(el01 25 37000 0) - if head goto :null25 - Error("null pointer") - null25: - head = call :List.Insert(head el01) - if head goto :null26 - Error("null pointer") - null26: - aux01 = call :List.Print(head) - PrintIntS(10000000) - el01 = HeapAllocZ(12) - if el01 goto :null27 - Error("null pointer") - null27: - aux01 = call :Element.Init(el01 39 42000 1) - el02 = el01 - if head goto :null28 - Error("null pointer") - null28: - head = call :List.Insert(head el01) - if head goto :null29 - Error("null pointer") - null29: - aux01 = call :List.Print(head) - PrintIntS(10000000) - el01 = HeapAllocZ(12) - if el01 goto :null30 - Error("null pointer") - null30: - aux01 = call :Element.Init(el01 22 34000 0) - if head goto :null31 - Error("null pointer") - null31: - head = call :List.Insert(head el01) - if head goto :null32 - Error("null pointer") - null32: - aux01 = call :List.Print(head) - el03 = HeapAllocZ(12) - if el03 goto :null33 - Error("null pointer") - null33: - aux01 = call :Element.Init(el03 27 34000 0) - if head goto :null34 - Error("null pointer") - null34: - t.0 = call :List.Search(head el02) - PrintIntS(t.0) - if head goto :null35 - Error("null pointer") - null35: - t.1 = call :List.Search(head el03) - PrintIntS(t.1) - PrintIntS(10000000) - el01 = HeapAllocZ(12) - if el01 goto :null36 - Error("null pointer") - null36: - aux01 = call :Element.Init(el01 28 35000 0) - if head goto :null37 - Error("null pointer") - null37: - head = call :List.Insert(head el01) - if head goto :null38 - Error("null pointer") - null38: - aux01 = call :List.Print(head) - PrintIntS(2220000) - if head goto :null39 - Error("null pointer") - null39: - head = call :List.Delete(head el02) - if head goto :null40 - Error("null pointer") - null40: - aux01 = call :List.Print(head) - PrintIntS(33300000) - if head goto :null41 - Error("null pointer") - null41: - head = call :List.Delete(head el01) - if head goto :null42 - Error("null pointer") - null42: - aux01 = call :List.Print(head) - PrintIntS(44440000) - ret 0 diff --git a/boil/tests/LinkedList.vapor b/boil/tests/LinkedList.vapor deleted file mode 100644 index bebdf94..0000000 --- a/boil/tests/LinkedList.vapor +++ /dev/null @@ -1,505 +0,0 @@ - -const vmt_Element - :Element.Init - :Element.GetAge - :Element.GetSalary - :Element.GetMarried - :Element.Equal - :Element.Compare - -const vmt_List - :List.Init - :List.InitNew - :List.Insert - :List.SetNext - :List.Delete - :List.Search - :List.GetEnd - :List.GetElem - :List.GetNext - :List.Print - -const vmt_LL - :LL.Start - - -func Main() - t.0 = HeapAllocZ(4) - [t.0] = :vmt_LL - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = [t.0] - t.1 = [t.1+0] - t.2 = call t.1(t.0) - PrintIntS(t.2) - ret - -func Element.Init(this v_Age v_Salary v_Married) - [this+4] = v_Age - [this+8] = v_Salary - [this+12] = v_Married - ret 1 - -func Element.GetAge(this) - t.0 = [this+4] - ret t.0 - -func Element.GetSalary(this) - t.0 = [this+8] - ret t.0 - -func Element.GetMarried(this) - t.0 = [this+12] - ret t.0 - -func Element.Equal(this other) - ret_val = 1 - if other goto :null2 - Error("null pointer") - null2: - t.0 = [other] - t.0 = [t.0+4] - aux01 = call t.0(other) - t.1 = [this] - t.1 = [t.1+20] - t.2 = [this+4] - t.3 = call t.1(this aux01 t.2) - t.4 = Sub(1 t.3) - if0 t.4 goto :if1_else - ret_val = 0 - goto :if1_end - if1_else: - if other goto :null3 - Error("null pointer") - null3: - t.5 = [other] - t.5 = [t.5+8] - aux02 = call t.5(other) - t.6 = [this] - t.6 = [t.6+20] - t.7 = [this+8] - t.8 = call t.6(this aux02 t.7) - t.9 = Sub(1 t.8) - if0 t.9 goto :if2_else - ret_val = 0 - goto :if2_end - if2_else: - t.10 = [this+12] - if0 t.10 goto :if3_else - if other goto :null4 - Error("null pointer") - null4: - t.11 = [other] - t.11 = [t.11+12] - t.12 = call t.11(other) - t.13 = Sub(1 t.12) - if0 t.13 goto :if4_else - ret_val = 0 - goto :if4_end - if4_else: - nt = 0 - if4_end: - goto :if3_end - if3_else: - if other goto :null5 - Error("null pointer") - null5: - t.14 = [other] - t.14 = [t.14+12] - t.15 = call t.14(other) - if0 t.15 goto :if5_else - ret_val = 0 - goto :if5_end - if5_else: - nt = 0 - if5_end: - if3_end: - if2_end: - if1_end: - ret ret_val - -func Element.Compare(this num1 num2) - retval = 0 - aux02 = Add(num2 1) - t.0 = LtS(num1 num2) - if0 t.0 goto :if6_else - retval = 0 - goto :if6_end - if6_else: - t.1 = LtS(num1 aux02) - t.2 = Sub(1 t.1) - if0 t.2 goto :if7_else - retval = 0 - goto :if7_end - if7_else: - retval = 1 - if7_end: - if6_end: - ret retval - -func List.Init(this) - [this+12] = 1 - ret 1 - -func List.InitNew(this v_elem v_next v_end) - [this+12] = v_end - [this+4] = v_elem - [this+8] = v_next - ret 1 - -func List.Insert(this new_elem) - aux03 = this - t.0 = HeapAllocZ(16) - [t.0] = :vmt_List - aux02 = t.0 - if aux02 goto :null6 - Error("null pointer") - null6: - t.1 = [aux02] - t.1 = [t.1+4] - ret_val = call t.1(aux02 new_elem aux03 0) - ret aux02 - -func List.SetNext(this v_next) - [this+8] = v_next - ret 1 - -func List.Delete(this e) - my_head = this - ret_val = 0 - aux04 = Sub(0 1) - aux01 = this - prev = this - var_end = [this+12] - var_elem = [this+4] - while1_top: - t.1 = Sub(1 var_end) - if0 t.1 goto :ss1_else - t.0 = Sub(1 ret_val) - goto :ss1_end - ss1_else: - t.0 = 0 - ss1_end: - if0 t.0 goto :while1_end - if e goto :null7 - Error("null pointer") - null7: - t.2 = [e] - t.2 = [t.2+16] - t.3 = call t.2(e var_elem) - if0 t.3 goto :if8_else - ret_val = 1 - t.4 = LtS(aux04 0) - if0 t.4 goto :if9_else - if aux01 goto :null8 - Error("null pointer") - null8: - t.5 = [aux01] - t.5 = [t.5+32] - my_head = call t.5(aux01) - goto :if9_end - if9_else: - t.6 = Sub(0 555) - PrintIntS(t.6) - if prev goto :null9 - Error("null pointer") - null9: - t.7 = [prev] - t.7 = [t.7+12] - if aux01 goto :null10 - Error("null pointer") - null10: - t.8 = [aux01] - t.8 = [t.8+32] - t.9 = call t.8(aux01) - aux05 = call t.7(prev t.9) - t.10 = Sub(0 555) - PrintIntS(t.10) - if9_end: - goto :if8_end - if8_else: - nt = 0 - if8_end: - t.11 = Sub(1 ret_val) - if0 t.11 goto :if10_else - prev = aux01 - if aux01 goto :null11 - Error("null pointer") - null11: - t.12 = [aux01] - t.12 = [t.12+32] - aux01 = call t.12(aux01) - if aux01 goto :null12 - Error("null pointer") - null12: - t.13 = [aux01] - t.13 = [t.13+24] - var_end = call t.13(aux01) - if aux01 goto :null13 - Error("null pointer") - null13: - t.14 = [aux01] - t.14 = [t.14+28] - var_elem = call t.14(aux01) - aux04 = 1 - goto :if10_end - if10_else: - nt = 0 - if10_end: - goto :while1_top - while1_end: - ret my_head - -func List.Search(this e) - int_ret_val = 0 - aux01 = this - var_end = [this+12] - var_elem = [this+4] - while2_top: - t.0 = Sub(1 var_end) - if0 t.0 goto :while2_end - if e goto :null14 - Error("null pointer") - null14: - t.1 = [e] - t.1 = [t.1+16] - t.2 = call t.1(e var_elem) - if0 t.2 goto :if11_else - int_ret_val = 1 - goto :if11_end - if11_else: - nt = 0 - if11_end: - if aux01 goto :null15 - Error("null pointer") - null15: - t.3 = [aux01] - t.3 = [t.3+32] - aux01 = call t.3(aux01) - if aux01 goto :null16 - Error("null pointer") - null16: - t.4 = [aux01] - t.4 = [t.4+24] - var_end = call t.4(aux01) - if aux01 goto :null17 - Error("null pointer") - null17: - t.5 = [aux01] - t.5 = [t.5+28] - var_elem = call t.5(aux01) - goto :while2_top - while2_end: - ret int_ret_val - -func List.GetEnd(this) - t.0 = [this+12] - ret t.0 - -func List.GetElem(this) - t.0 = [this+4] - ret t.0 - -func List.GetNext(this) - t.0 = [this+8] - ret t.0 - -func List.Print(this) - aux01 = this - var_end = [this+12] - var_elem = [this+4] - while3_top: - t.0 = Sub(1 var_end) - if0 t.0 goto :while3_end - if var_elem goto :null18 - Error("null pointer") - null18: - t.1 = [var_elem] - t.1 = [t.1+4] - t.2 = call t.1(var_elem) - PrintIntS(t.2) - if aux01 goto :null19 - Error("null pointer") - null19: - t.3 = [aux01] - t.3 = [t.3+32] - aux01 = call t.3(aux01) - if aux01 goto :null20 - Error("null pointer") - null20: - t.4 = [aux01] - t.4 = [t.4+24] - var_end = call t.4(aux01) - if aux01 goto :null21 - Error("null pointer") - null21: - t.5 = [aux01] - t.5 = [t.5+28] - var_elem = call t.5(aux01) - goto :while3_top - while3_end: - ret 1 - -func LL.Start(this) - t.0 = HeapAllocZ(16) - [t.0] = :vmt_List - last_elem = t.0 - if last_elem goto :null22 - Error("null pointer") - null22: - t.1 = [last_elem] - t.1 = [t.1+0] - aux01 = call t.1(last_elem) - head = last_elem - if head goto :null23 - Error("null pointer") - null23: - t.2 = [head] - t.2 = [t.2+0] - aux01 = call t.2(head) - if head goto :null24 - Error("null pointer") - null24: - t.3 = [head] - t.3 = [t.3+36] - aux01 = call t.3(head) - t.4 = HeapAllocZ(16) - [t.4] = :vmt_Element - el01 = t.4 - if el01 goto :null25 - Error("null pointer") - null25: - t.5 = [el01] - t.5 = [t.5+0] - aux01 = call t.5(el01 25 37000 0) - if head goto :null26 - Error("null pointer") - null26: - t.6 = [head] - t.6 = [t.6+8] - head = call t.6(head el01) - if head goto :null27 - Error("null pointer") - null27: - t.7 = [head] - t.7 = [t.7+36] - aux01 = call t.7(head) - PrintIntS(10000000) - t.8 = HeapAllocZ(16) - [t.8] = :vmt_Element - el01 = t.8 - if el01 goto :null28 - Error("null pointer") - null28: - t.9 = [el01] - t.9 = [t.9+0] - aux01 = call t.9(el01 39 42000 1) - el02 = el01 - if head goto :null29 - Error("null pointer") - null29: - t.10 = [head] - t.10 = [t.10+8] - head = call t.10(head el01) - if head goto :null30 - Error("null pointer") - null30: - t.11 = [head] - t.11 = [t.11+36] - aux01 = call t.11(head) - PrintIntS(10000000) - t.12 = HeapAllocZ(16) - [t.12] = :vmt_Element - el01 = t.12 - if el01 goto :null31 - Error("null pointer") - null31: - t.13 = [el01] - t.13 = [t.13+0] - aux01 = call t.13(el01 22 34000 0) - if head goto :null32 - Error("null pointer") - null32: - t.14 = [head] - t.14 = [t.14+8] - head = call t.14(head el01) - if head goto :null33 - Error("null pointer") - null33: - t.15 = [head] - t.15 = [t.15+36] - aux01 = call t.15(head) - t.16 = HeapAllocZ(16) - [t.16] = :vmt_Element - el03 = t.16 - if el03 goto :null34 - Error("null pointer") - null34: - t.17 = [el03] - t.17 = [t.17+0] - aux01 = call t.17(el03 27 34000 0) - if head goto :null35 - Error("null pointer") - null35: - t.18 = [head] - t.18 = [t.18+20] - t.19 = call t.18(head el02) - PrintIntS(t.19) - if head goto :null36 - Error("null pointer") - null36: - t.20 = [head] - t.20 = [t.20+20] - t.21 = call t.20(head el03) - PrintIntS(t.21) - PrintIntS(10000000) - t.22 = HeapAllocZ(16) - [t.22] = :vmt_Element - el01 = t.22 - if el01 goto :null37 - Error("null pointer") - null37: - t.23 = [el01] - t.23 = [t.23+0] - aux01 = call t.23(el01 28 35000 0) - if head goto :null38 - Error("null pointer") - null38: - t.24 = [head] - t.24 = [t.24+8] - head = call t.24(head el01) - if head goto :null39 - Error("null pointer") - null39: - t.25 = [head] - t.25 = [t.25+36] - aux01 = call t.25(head) - PrintIntS(2220000) - if head goto :null40 - Error("null pointer") - null40: - t.26 = [head] - t.26 = [t.26+16] - head = call t.26(head el02) - if head goto :null41 - Error("null pointer") - null41: - t.27 = [head] - t.27 = [t.27+36] - aux01 = call t.27(head) - PrintIntS(33300000) - if head goto :null42 - Error("null pointer") - null42: - t.28 = [head] - t.28 = [t.28+16] - head = call t.28(head el01) - if head goto :null43 - Error("null pointer") - null43: - t.29 = [head] - t.29 = [t.29+36] - aux01 = call t.29(head) - PrintIntS(44440000) - ret 0 diff --git a/boil/tests/MoreThan4.opt.vapor b/boil/tests/MoreThan4.opt.vapor deleted file mode 100644 index a59d1b5..0000000 --- a/boil/tests/MoreThan4.opt.vapor +++ /dev/null @@ -1,27 +0,0 @@ - -const empty_MT4 - - -func Main() - t.0 = call :MT4.Start(:empty_MT4 1 2 3 4 5 6) - PrintIntS(t.0) - ret - -func MT4.Start(this p1 p2 p3 p4 p5 p6) - PrintIntS(p1) - PrintIntS(p2) - PrintIntS(p3) - PrintIntS(p4) - PrintIntS(p5) - PrintIntS(p6) - aux = call :MT4.Change(this p6 p5 p4 p3 p2 p1) - ret aux - -func MT4.Change(this p1 p2 p3 p4 p5 p6) - PrintIntS(p1) - PrintIntS(p2) - PrintIntS(p3) - PrintIntS(p4) - PrintIntS(p5) - PrintIntS(p6) - ret 0 diff --git a/boil/tests/MoreThan4.vapor b/boil/tests/MoreThan4.vapor deleted file mode 100644 index 6067f8e..0000000 --- a/boil/tests/MoreThan4.vapor +++ /dev/null @@ -1,38 +0,0 @@ - -const vmt_MT4 - :MT4.Start - :MT4.Change - - -func Main() - t.0 = HeapAllocZ(4) - [t.0] = :vmt_MT4 - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = [t.0] - t.1 = [t.1+0] - t.2 = call t.1(t.0 1 2 3 4 5 6) - PrintIntS(t.2) - ret - -func MT4.Start(this p1 p2 p3 p4 p5 p6) - PrintIntS(p1) - PrintIntS(p2) - PrintIntS(p3) - PrintIntS(p4) - PrintIntS(p5) - PrintIntS(p6) - t.0 = [this] - t.0 = [t.0+4] - aux = call t.0(this p6 p5 p4 p3 p2 p1) - ret aux - -func MT4.Change(this p1 p2 p3 p4 p5 p6) - PrintIntS(p1) - PrintIntS(p2) - PrintIntS(p3) - PrintIntS(p4) - PrintIntS(p5) - PrintIntS(p6) - ret 0 diff --git a/boil/tests/QuickSort.opt.vapor b/boil/tests/QuickSort.opt.vapor deleted file mode 100644 index 6e14e5a..0000000 --- a/boil/tests/QuickSort.opt.vapor +++ /dev/null @@ -1,378 +0,0 @@ - -const empty_QS - - -func Main() - t.0 = HeapAllocZ(8) - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = call :QS.Start(t.0 10) - PrintIntS(t.1) - ret - -func QS.Start(this sz) - aux01 = call :QS.Init(this sz) - aux01 = call :QS.Print(this) - PrintIntS(9999) - t.0 = [this+4] - aux01 = Sub(t.0 1) - aux01 = call :QS.Sort(this 0 aux01) - aux01 = call :QS.Print(this) - ret 0 - -func QS.Sort(this left right) - t = 0 - t.0 = LtS(left right) - if0 t.0 goto :if1_else - t.1 = [this+0] - if t.1 goto :null2 - Error("null pointer") - null2: - t.2 = [t.1] - t.2 = Lt(right t.2) - if t.2 goto :bounds1 - Error("array index out of bounds") - bounds1: - t.2 = MulS(right 4) - t.2 = Add(t.2 t.1) - v = [t.2+4] - i = Sub(left 1) - j = right - cont01 = 1 - while1_top: - if0 cont01 goto :while1_end - cont02 = 1 - while2_top: - if0 cont02 goto :while2_end - i = Add(i 1) - t.3 = [this+0] - if t.3 goto :null3 - Error("null pointer") - null3: - t.4 = [t.3] - t.4 = Lt(i t.4) - if t.4 goto :bounds2 - Error("array index out of bounds") - bounds2: - t.4 = MulS(i 4) - t.4 = Add(t.4 t.3) - aux03 = [t.4+4] - t.5 = LtS(aux03 v) - if t.5 goto :if2_else - cont02 = 0 - goto :if2_end - if2_else: - cont02 = 1 - if2_end: - goto :while2_top - while2_end: - cont02 = 1 - while3_top: - if0 cont02 goto :while3_end - j = Sub(j 1) - t.6 = [this+0] - if t.6 goto :null4 - Error("null pointer") - null4: - t.7 = [t.6] - t.7 = Lt(j t.7) - if t.7 goto :bounds3 - Error("array index out of bounds") - bounds3: - t.7 = MulS(j 4) - t.7 = Add(t.7 t.6) - aux03 = [t.7+4] - t.8 = LtS(v aux03) - if t.8 goto :if3_else - cont02 = 0 - goto :if3_end - if3_else: - cont02 = 1 - if3_end: - goto :while3_top - while3_end: - t.9 = [this+0] - if t.9 goto :null5 - Error("null pointer") - null5: - t.10 = [t.9] - t.10 = Lt(i t.10) - if t.10 goto :bounds4 - Error("array index out of bounds") - bounds4: - t.10 = MulS(i 4) - t.10 = Add(t.10 t.9) - t = [t.10+4] - t.11 = [this+0] - if t.11 goto :null6 - Error("null pointer") - null6: - t.12 = [t.11] - t.12 = Lt(i t.12) - if t.12 goto :bounds5 - Error("array index out of bounds") - bounds5: - t.12 = MulS(i 4) - t.12 = Add(t.12 t.11) - t.13 = [this+0] - if t.13 goto :null7 - Error("null pointer") - null7: - t.14 = [t.13] - t.14 = Lt(j t.14) - if t.14 goto :bounds6 - Error("array index out of bounds") - bounds6: - t.14 = MulS(j 4) - t.14 = Add(t.14 t.13) - t.15 = [t.14+4] - [t.12+4] = t.15 - t.16 = [this+0] - if t.16 goto :null8 - Error("null pointer") - null8: - t.17 = [t.16] - t.17 = Lt(j t.17) - if t.17 goto :bounds7 - Error("array index out of bounds") - bounds7: - t.17 = MulS(j 4) - t.17 = Add(t.17 t.16) - [t.17+4] = t - t.18 = Add(i 1) - t.19 = LtS(j t.18) - if0 t.19 goto :if4_else - cont01 = 0 - goto :if4_end - if4_else: - cont01 = 1 - if4_end: - goto :while1_top - while1_end: - t.20 = [this+0] - if t.20 goto :null9 - Error("null pointer") - null9: - t.21 = [t.20] - t.21 = Lt(j t.21) - if t.21 goto :bounds8 - Error("array index out of bounds") - bounds8: - t.21 = MulS(j 4) - t.21 = Add(t.21 t.20) - t.22 = [this+0] - if t.22 goto :null10 - Error("null pointer") - null10: - t.23 = [t.22] - t.23 = Lt(i t.23) - if t.23 goto :bounds9 - Error("array index out of bounds") - bounds9: - t.23 = MulS(i 4) - t.23 = Add(t.23 t.22) - t.24 = [t.23+4] - [t.21+4] = t.24 - t.25 = [this+0] - if t.25 goto :null11 - Error("null pointer") - null11: - t.26 = [t.25] - t.26 = Lt(i t.26) - if t.26 goto :bounds10 - Error("array index out of bounds") - bounds10: - t.26 = MulS(i 4) - t.26 = Add(t.26 t.25) - t.27 = [this+0] - if t.27 goto :null12 - Error("null pointer") - null12: - t.28 = [t.27] - t.28 = Lt(right t.28) - if t.28 goto :bounds11 - Error("array index out of bounds") - bounds11: - t.28 = MulS(right 4) - t.28 = Add(t.28 t.27) - t.29 = [t.28+4] - [t.26+4] = t.29 - t.30 = [this+0] - if t.30 goto :null13 - Error("null pointer") - null13: - t.31 = [t.30] - t.31 = Lt(right t.31) - if t.31 goto :bounds12 - Error("array index out of bounds") - bounds12: - t.31 = MulS(right 4) - t.31 = Add(t.31 t.30) - [t.31+4] = t - t.32 = Sub(i 1) - nt = call :QS.Sort(this left t.32) - t.33 = Add(i 1) - nt = call :QS.Sort(this t.33 right) - goto :if1_end - if1_else: - nt = 0 - if1_end: - ret 0 - -func QS.Print(this) - j = 0 - while4_top: - t.0 = [this+4] - t.1 = LtS(j t.0) - if0 t.1 goto :while4_end - t.2 = [this+0] - if t.2 goto :null14 - Error("null pointer") - null14: - t.3 = [t.2] - t.3 = Lt(j t.3) - if t.3 goto :bounds13 - Error("array index out of bounds") - bounds13: - t.3 = MulS(j 4) - t.3 = Add(t.3 t.2) - t.4 = [t.3+4] - PrintIntS(t.4) - j = Add(j 1) - goto :while4_top - while4_end: - ret 0 - -func QS.Init(this sz) - [this+4] = sz - t.0 = call :AllocArray(sz) - [this+0] = t.0 - t.1 = [this+0] - if t.1 goto :null15 - Error("null pointer") - null15: - t.2 = [t.1] - t.2 = Lt(0 t.2) - if t.2 goto :bounds14 - Error("array index out of bounds") - bounds14: - t.2 = MulS(0 4) - t.2 = Add(t.2 t.1) - [t.2+4] = 20 - t.3 = [this+0] - if t.3 goto :null16 - Error("null pointer") - null16: - t.4 = [t.3] - t.4 = Lt(1 t.4) - if t.4 goto :bounds15 - Error("array index out of bounds") - bounds15: - t.4 = MulS(1 4) - t.4 = Add(t.4 t.3) - [t.4+4] = 7 - t.5 = [this+0] - if t.5 goto :null17 - Error("null pointer") - null17: - t.6 = [t.5] - t.6 = Lt(2 t.6) - if t.6 goto :bounds16 - Error("array index out of bounds") - bounds16: - t.6 = MulS(2 4) - t.6 = Add(t.6 t.5) - [t.6+4] = 12 - t.7 = [this+0] - if t.7 goto :null18 - Error("null pointer") - null18: - t.8 = [t.7] - t.8 = Lt(3 t.8) - if t.8 goto :bounds17 - Error("array index out of bounds") - bounds17: - t.8 = MulS(3 4) - t.8 = Add(t.8 t.7) - [t.8+4] = 18 - t.9 = [this+0] - if t.9 goto :null19 - Error("null pointer") - null19: - t.10 = [t.9] - t.10 = Lt(4 t.10) - if t.10 goto :bounds18 - Error("array index out of bounds") - bounds18: - t.10 = MulS(4 4) - t.10 = Add(t.10 t.9) - [t.10+4] = 2 - t.11 = [this+0] - if t.11 goto :null20 - Error("null pointer") - null20: - t.12 = [t.11] - t.12 = Lt(5 t.12) - if t.12 goto :bounds19 - Error("array index out of bounds") - bounds19: - t.12 = MulS(5 4) - t.12 = Add(t.12 t.11) - [t.12+4] = 11 - t.13 = [this+0] - if t.13 goto :null21 - Error("null pointer") - null21: - t.14 = [t.13] - t.14 = Lt(6 t.14) - if t.14 goto :bounds20 - Error("array index out of bounds") - bounds20: - t.14 = MulS(6 4) - t.14 = Add(t.14 t.13) - [t.14+4] = 6 - t.15 = [this+0] - if t.15 goto :null22 - Error("null pointer") - null22: - t.16 = [t.15] - t.16 = Lt(7 t.16) - if t.16 goto :bounds21 - Error("array index out of bounds") - bounds21: - t.16 = MulS(7 4) - t.16 = Add(t.16 t.15) - [t.16+4] = 9 - t.17 = [this+0] - if t.17 goto :null23 - Error("null pointer") - null23: - t.18 = [t.17] - t.18 = Lt(8 t.18) - if t.18 goto :bounds22 - Error("array index out of bounds") - bounds22: - t.18 = MulS(8 4) - t.18 = Add(t.18 t.17) - [t.18+4] = 19 - t.19 = [this+0] - if t.19 goto :null24 - Error("null pointer") - null24: - t.20 = [t.19] - t.20 = Lt(9 t.20) - if t.20 goto :bounds23 - Error("array index out of bounds") - bounds23: - t.20 = MulS(9 4) - t.20 = Add(t.20 t.19) - [t.20+4] = 5 - ret 0 - -func AllocArray(size) - bytes = MulS(size 4) - bytes = Add(bytes 4) - v = HeapAllocZ(bytes) - [v] = size - ret v diff --git a/boil/tests/QuickSort.vapor b/boil/tests/QuickSort.vapor deleted file mode 100644 index 3fe3798..0000000 --- a/boil/tests/QuickSort.vapor +++ /dev/null @@ -1,399 +0,0 @@ - -const vmt_QS - :QS.Start - :QS.Sort - :QS.Print - :QS.Init - - -func Main() - t.0 = HeapAllocZ(12) - [t.0] = :vmt_QS - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = [t.0] - t.1 = [t.1+0] - t.2 = call t.1(t.0 10) - PrintIntS(t.2) - ret - -func QS.Start(this sz) - t.0 = [this] - t.0 = [t.0+12] - aux01 = call t.0(this sz) - t.1 = [this] - t.1 = [t.1+8] - aux01 = call t.1(this) - PrintIntS(9999) - t.2 = [this+8] - aux01 = Sub(t.2 1) - t.3 = [this] - t.3 = [t.3+4] - aux01 = call t.3(this 0 aux01) - t.4 = [this] - t.4 = [t.4+8] - aux01 = call t.4(this) - ret 0 - -func QS.Sort(this left right) - t = 0 - t.0 = LtS(left right) - if0 t.0 goto :if1_else - t.1 = [this+4] - if t.1 goto :null2 - Error("null pointer") - null2: - t.2 = [t.1] - t.2 = Lt(right t.2) - if t.2 goto :bounds1 - Error("array index out of bounds") - bounds1: - t.2 = MulS(right 4) - t.2 = Add(t.2 t.1) - v = [t.2+4] - i = Sub(left 1) - j = right - cont01 = 1 - while1_top: - if0 cont01 goto :while1_end - cont02 = 1 - while2_top: - if0 cont02 goto :while2_end - i = Add(i 1) - t.3 = [this+4] - if t.3 goto :null3 - Error("null pointer") - null3: - t.4 = [t.3] - t.4 = Lt(i t.4) - if t.4 goto :bounds2 - Error("array index out of bounds") - bounds2: - t.4 = MulS(i 4) - t.4 = Add(t.4 t.3) - aux03 = [t.4+4] - t.5 = LtS(aux03 v) - t.6 = Sub(1 t.5) - if0 t.6 goto :if2_else - cont02 = 0 - goto :if2_end - if2_else: - cont02 = 1 - if2_end: - goto :while2_top - while2_end: - cont02 = 1 - while3_top: - if0 cont02 goto :while3_end - j = Sub(j 1) - t.7 = [this+4] - if t.7 goto :null4 - Error("null pointer") - null4: - t.8 = [t.7] - t.8 = Lt(j t.8) - if t.8 goto :bounds3 - Error("array index out of bounds") - bounds3: - t.8 = MulS(j 4) - t.8 = Add(t.8 t.7) - aux03 = [t.8+4] - t.9 = LtS(v aux03) - t.10 = Sub(1 t.9) - if0 t.10 goto :if3_else - cont02 = 0 - goto :if3_end - if3_else: - cont02 = 1 - if3_end: - goto :while3_top - while3_end: - t.11 = [this+4] - if t.11 goto :null5 - Error("null pointer") - null5: - t.12 = [t.11] - t.12 = Lt(i t.12) - if t.12 goto :bounds4 - Error("array index out of bounds") - bounds4: - t.12 = MulS(i 4) - t.12 = Add(t.12 t.11) - t = [t.12+4] - t.13 = [this+4] - if t.13 goto :null6 - Error("null pointer") - null6: - t.14 = [t.13] - t.14 = Lt(i t.14) - if t.14 goto :bounds5 - Error("array index out of bounds") - bounds5: - t.14 = MulS(i 4) - t.14 = Add(t.14 t.13) - t.15 = [this+4] - if t.15 goto :null7 - Error("null pointer") - null7: - t.16 = [t.15] - t.16 = Lt(j t.16) - if t.16 goto :bounds6 - Error("array index out of bounds") - bounds6: - t.16 = MulS(j 4) - t.16 = Add(t.16 t.15) - t.17 = [t.16+4] - [t.14+4] = t.17 - t.18 = [this+4] - if t.18 goto :null8 - Error("null pointer") - null8: - t.19 = [t.18] - t.19 = Lt(j t.19) - if t.19 goto :bounds7 - Error("array index out of bounds") - bounds7: - t.19 = MulS(j 4) - t.19 = Add(t.19 t.18) - [t.19+4] = t - t.20 = Add(i 1) - t.21 = LtS(j t.20) - if0 t.21 goto :if4_else - cont01 = 0 - goto :if4_end - if4_else: - cont01 = 1 - if4_end: - goto :while1_top - while1_end: - t.22 = [this+4] - if t.22 goto :null9 - Error("null pointer") - null9: - t.23 = [t.22] - t.23 = Lt(j t.23) - if t.23 goto :bounds8 - Error("array index out of bounds") - bounds8: - t.23 = MulS(j 4) - t.23 = Add(t.23 t.22) - t.24 = [this+4] - if t.24 goto :null10 - Error("null pointer") - null10: - t.25 = [t.24] - t.25 = Lt(i t.25) - if t.25 goto :bounds9 - Error("array index out of bounds") - bounds9: - t.25 = MulS(i 4) - t.25 = Add(t.25 t.24) - t.26 = [t.25+4] - [t.23+4] = t.26 - t.27 = [this+4] - if t.27 goto :null11 - Error("null pointer") - null11: - t.28 = [t.27] - t.28 = Lt(i t.28) - if t.28 goto :bounds10 - Error("array index out of bounds") - bounds10: - t.28 = MulS(i 4) - t.28 = Add(t.28 t.27) - t.29 = [this+4] - if t.29 goto :null12 - Error("null pointer") - null12: - t.30 = [t.29] - t.30 = Lt(right t.30) - if t.30 goto :bounds11 - Error("array index out of bounds") - bounds11: - t.30 = MulS(right 4) - t.30 = Add(t.30 t.29) - t.31 = [t.30+4] - [t.28+4] = t.31 - t.32 = [this+4] - if t.32 goto :null13 - Error("null pointer") - null13: - t.33 = [t.32] - t.33 = Lt(right t.33) - if t.33 goto :bounds12 - Error("array index out of bounds") - bounds12: - t.33 = MulS(right 4) - t.33 = Add(t.33 t.32) - [t.33+4] = t - t.34 = [this] - t.34 = [t.34+4] - t.35 = Sub(i 1) - nt = call t.34(this left t.35) - t.36 = [this] - t.36 = [t.36+4] - t.37 = Add(i 1) - nt = call t.36(this t.37 right) - goto :if1_end - if1_else: - nt = 0 - if1_end: - ret 0 - -func QS.Print(this) - j = 0 - while4_top: - t.0 = [this+8] - t.1 = LtS(j t.0) - if0 t.1 goto :while4_end - t.2 = [this+4] - if t.2 goto :null14 - Error("null pointer") - null14: - t.3 = [t.2] - t.3 = Lt(j t.3) - if t.3 goto :bounds13 - Error("array index out of bounds") - bounds13: - t.3 = MulS(j 4) - t.3 = Add(t.3 t.2) - t.4 = [t.3+4] - PrintIntS(t.4) - j = Add(j 1) - goto :while4_top - while4_end: - ret 0 - -func QS.Init(this sz) - [this+8] = sz - t.0 = call :AllocArray(sz) - [this+4] = t.0 - t.1 = [this+4] - if t.1 goto :null15 - Error("null pointer") - null15: - t.2 = [t.1] - t.2 = Lt(0 t.2) - if t.2 goto :bounds14 - Error("array index out of bounds") - bounds14: - t.2 = MulS(0 4) - t.2 = Add(t.2 t.1) - [t.2+4] = 20 - t.3 = [this+4] - if t.3 goto :null16 - Error("null pointer") - null16: - t.4 = [t.3] - t.4 = Lt(1 t.4) - if t.4 goto :bounds15 - Error("array index out of bounds") - bounds15: - t.4 = MulS(1 4) - t.4 = Add(t.4 t.3) - [t.4+4] = 7 - t.5 = [this+4] - if t.5 goto :null17 - Error("null pointer") - null17: - t.6 = [t.5] - t.6 = Lt(2 t.6) - if t.6 goto :bounds16 - Error("array index out of bounds") - bounds16: - t.6 = MulS(2 4) - t.6 = Add(t.6 t.5) - [t.6+4] = 12 - t.7 = [this+4] - if t.7 goto :null18 - Error("null pointer") - null18: - t.8 = [t.7] - t.8 = Lt(3 t.8) - if t.8 goto :bounds17 - Error("array index out of bounds") - bounds17: - t.8 = MulS(3 4) - t.8 = Add(t.8 t.7) - [t.8+4] = 18 - t.9 = [this+4] - if t.9 goto :null19 - Error("null pointer") - null19: - t.10 = [t.9] - t.10 = Lt(4 t.10) - if t.10 goto :bounds18 - Error("array index out of bounds") - bounds18: - t.10 = MulS(4 4) - t.10 = Add(t.10 t.9) - [t.10+4] = 2 - t.11 = [this+4] - if t.11 goto :null20 - Error("null pointer") - null20: - t.12 = [t.11] - t.12 = Lt(5 t.12) - if t.12 goto :bounds19 - Error("array index out of bounds") - bounds19: - t.12 = MulS(5 4) - t.12 = Add(t.12 t.11) - [t.12+4] = 11 - t.13 = [this+4] - if t.13 goto :null21 - Error("null pointer") - null21: - t.14 = [t.13] - t.14 = Lt(6 t.14) - if t.14 goto :bounds20 - Error("array index out of bounds") - bounds20: - t.14 = MulS(6 4) - t.14 = Add(t.14 t.13) - [t.14+4] = 6 - t.15 = [this+4] - if t.15 goto :null22 - Error("null pointer") - null22: - t.16 = [t.15] - t.16 = Lt(7 t.16) - if t.16 goto :bounds21 - Error("array index out of bounds") - bounds21: - t.16 = MulS(7 4) - t.16 = Add(t.16 t.15) - [t.16+4] = 9 - t.17 = [this+4] - if t.17 goto :null23 - Error("null pointer") - null23: - t.18 = [t.17] - t.18 = Lt(8 t.18) - if t.18 goto :bounds22 - Error("array index out of bounds") - bounds22: - t.18 = MulS(8 4) - t.18 = Add(t.18 t.17) - [t.18+4] = 19 - t.19 = [this+4] - if t.19 goto :null24 - Error("null pointer") - null24: - t.20 = [t.19] - t.20 = Lt(9 t.20) - if t.20 goto :bounds23 - Error("array index out of bounds") - bounds23: - t.20 = MulS(9 4) - t.20 = Add(t.20 t.19) - [t.20+4] = 5 - ret 0 - -func AllocArray(size) - bytes = MulS(size 4) - bytes = Add(bytes 4) - v = HeapAllocZ(bytes) - [v] = size - ret v diff --git a/boil/tests/ShortCircuit.opt.vapor b/boil/tests/ShortCircuit.opt.vapor deleted file mode 100644 index 8275acd..0000000 --- a/boil/tests/ShortCircuit.opt.vapor +++ /dev/null @@ -1,215 +0,0 @@ - -const vmt_Main - :Main.run1 - :Main.run2 - :Main.run3 - :Main.run4 - :Main.if1 - :Main.if2 - :Main.if3 - :Main.if4 - :Main.if5 - :Main.if6 - - -func Main() - PrintIntS(1) - ret - -func Main.run1(this a b c) - if0 a goto :ss2_else - t.1 = b - goto :ss2_end - ss2_else: - t.1 = 0 - ss2_end: - if0 t.1 goto :ss1_else - t.0 = 1 - goto :ss1_end - ss1_else: - t.0 = c - ss1_end: - ret t.0 - -func Main.run2(this a b c) - if0 a goto :ss3_else - if0 b goto :ss4_else - t.1 = 1 - goto :ss4_end - ss4_else: - t.1 = c - ss4_end: - t.0 = t.1 - goto :ss3_end - ss3_else: - t.0 = 0 - ss3_end: - ret t.0 - -func Main.run3(this a b c) - if0 a goto :ss6_else - t.1 = 1 - goto :ss6_end - ss6_else: - t.1 = b - ss6_end: - if0 t.1 goto :ss5_else - t.0 = c - goto :ss5_end - ss5_else: - t.0 = 0 - ss5_end: - ret t.0 - -func Main.run4(this a b c) - if0 a goto :ss7_else - t.0 = 1 - goto :ss7_end - ss7_else: - if0 b goto :ss8_else - t.1 = c - goto :ss8_end - ss8_else: - t.1 = 0 - ss8_end: - t.0 = t.1 - ss7_end: - ret t.0 - -func Main.if1(this a b c) - if0 a goto :ss10_else - t.1 = b - goto :ss10_end - ss10_else: - t.1 = 0 - ss10_end: - if0 t.1 goto :ss9_else - t.0 = 1 - goto :ss9_end - ss9_else: - t.0 = c - ss9_end: - if0 t.0 goto :if1_else - if1_then: - PrintIntS(1) - goto :if1_end - if1_else: - if1_end: - ret 1 - -func Main.if2(this a b c) - if0 a goto :ss11_else - if0 b goto :ss12_else - t.1 = 1 - goto :ss12_end - ss12_else: - t.1 = c - ss12_end: - t.0 = t.1 - goto :ss11_end - ss11_else: - t.0 = 0 - ss11_end: - if0 t.0 goto :if2_else - if2_then: - PrintIntS(2) - goto :if2_end - if2_else: - if2_end: - ret 1 - -func Main.if3(this a b c) - if0 a goto :ss14_else - t.1 = 1 - goto :ss14_end - ss14_else: - t.1 = b - ss14_end: - if0 t.1 goto :ss13_else - t.0 = c - goto :ss13_end - ss13_else: - t.0 = 0 - ss13_end: - if0 t.0 goto :if3_else - if3_then: - PrintIntS(3) - goto :if3_end - if3_else: - if3_end: - ret 1 - -func Main.if4(this a b c) - if0 a goto :ss15_else - t.0 = 1 - goto :ss15_end - ss15_else: - if0 b goto :ss16_else - t.1 = c - goto :ss16_end - ss16_else: - t.1 = 0 - ss16_end: - t.0 = t.1 - ss15_end: - if0 t.0 goto :if4_else - if4_then: - PrintIntS(4) - goto :if4_end - if4_else: - if4_end: - ret 1 - -func Main.if5(this a b c d) - if0 a goto :ss19_else - t.2 = 1 - goto :ss19_end - ss19_else: - t.2 = b - ss19_end: - if0 t.2 goto :ss18_else - t.1 = 1 - goto :ss18_end - ss18_else: - t.1 = c - ss18_end: - if0 t.1 goto :ss17_else - t.0 = 1 - goto :ss17_end - ss17_else: - t.0 = d - ss17_end: - if0 t.0 goto :if5_else - if5_then: - PrintIntS(5) - goto :if5_end - if5_else: - if5_end: - ret 1 - -func Main.if6(this a b c d) - if0 a goto :ss22_else - t.2 = b - goto :ss22_end - ss22_else: - t.2 = 0 - ss22_end: - if0 t.2 goto :ss21_else - t.1 = c - goto :ss21_end - ss21_else: - t.1 = 0 - ss21_end: - if0 t.1 goto :ss20_else - t.0 = d - goto :ss20_end - ss20_else: - t.0 = 0 - ss20_end: - if0 t.0 goto :if6_else - if6_then: - PrintIntS(6) - goto :if6_end - if6_else: - if6_end: - ret 1 diff --git a/boil/tests/ShortCircuit.vapor b/boil/tests/ShortCircuit.vapor deleted file mode 100644 index 31cc088..0000000 --- a/boil/tests/ShortCircuit.vapor +++ /dev/null @@ -1,128 +0,0 @@ - -const empty_Main - - -func Main() - PrintIntS(1) - ret - -func Main.run1(this a b c) - if0 a goto :ss1_else - if0 b goto :ss1_else - t.0 = 1 - goto :ss1_end - ss1_else: - t.0 = c - ss1_end: - ret t.0 - -func Main.run2(this a b c) - if0 a goto :ss3_else - if0 b goto :ss4_else - t.1 = 1 - goto :ss4_end - ss4_else: - t.1 = c - ss4_end: - t.0 = t.1 - goto :ss3_end - ss3_else: - t.0 = 0 - ss3_end: - ret t.0 - -func Main.run3(this a b c) - if a goto :ss5_then - if0 b goto :ss5_else - ss5_then: - t.0 = c - goto :ss5_end - ss5_else: - t.0 = 0 - ss5_end: - ret t.0 - -func Main.run4(this a b c) - if0 a goto :ss7_else - t.0 = 1 - goto :ss7_end - ss7_else: - if0 b goto :ss8_else - t.1 = c - goto :ss8_end - ss8_else: - t.1 = 0 - ss8_end: - t.0 = t.1 - ss7_end: - ret t.0 - -func Main.if1(this a b c) - if0 a goto :ss9 - if b goto :if1_then - ss9: - if0 c goto :if1_else - if1_then: - PrintIntS(1) - goto :if1_end - if1_else: - if1_end: - ret 1 - -func Main.if2(this a b c) - if0 a goto :if2_else - if b goto :if2_then - if0 c goto :if2_else - if2_then: - PrintIntS(2) - goto :if2_end - if2_else: - if2_end: - ret 1 - -func Main.if3(this a b c) - if a goto :ss13 - if0 b goto :if3_else - ss13: - if0 c goto :if3_else - if3_then: - PrintIntS(3) - goto :if3_end - if3_else: - if3_end: - ret 1 - -func Main.if4(this a b c) - if a goto :if4_then - if0 b goto :if4_else - if0 c goto :if4_else - if4_then: - PrintIntS(4) - goto :if4_end - if4_else: - if4_end: - ret 1 - -func Main.if5(this a b c d) - if a goto :if5_then - if b goto :if5_then - if c goto :if5_then - if0 d goto :if5_else - if5_then: - PrintIntS(5) - goto :if5_end - if5_else: - if5_end: - ret 1 - -func Main.if6(this a b c d) - if0 a goto :if6_else - if0 b goto :if6_else - if0 c goto :if6_else - if0 d goto :if6_else - if6_then: - PrintIntS(6) - goto :if6_end - if6_else: - if6_end: - ret 1 diff --git a/boil/tests/TreeVisitor.opt.vapor b/boil/tests/TreeVisitor.opt.vapor deleted file mode 100644 index dfa80a6..0000000 --- a/boil/tests/TreeVisitor.opt.vapor +++ /dev/null @@ -1,635 +0,0 @@ - -const empty_TV - -const empty_Tree - -const vmt_Visitor - :Visitor.visit - -const vmt_MyVisitor - :MyVisitor.visit - - -func Main() - t.0 = call :TV.Start(:empty_TV) - PrintIntS(t.0) - ret - -func TV.Start(this) - root = HeapAllocZ(24) - if root goto :null1 - Error("null pointer") - null1: - ntb = call :Tree.Init(root 16) - if root goto :null2 - Error("null pointer") - null2: - ntb = call :Tree.Print(root) - PrintIntS(100000000) - if root goto :null3 - Error("null pointer") - null3: - ntb = call :Tree.Insert(root 8) - if root goto :null4 - Error("null pointer") - null4: - ntb = call :Tree.Insert(root 24) - if root goto :null5 - Error("null pointer") - null5: - ntb = call :Tree.Insert(root 4) - if root goto :null6 - Error("null pointer") - null6: - ntb = call :Tree.Insert(root 12) - if root goto :null7 - Error("null pointer") - null7: - ntb = call :Tree.Insert(root 20) - if root goto :null8 - Error("null pointer") - null8: - ntb = call :Tree.Insert(root 28) - if root goto :null9 - Error("null pointer") - null9: - ntb = call :Tree.Insert(root 14) - if root goto :null10 - Error("null pointer") - null10: - ntb = call :Tree.Print(root) - PrintIntS(100000000) - t.0 = HeapAllocZ(12) - [t.0] = :vmt_MyVisitor - v = t.0 - PrintIntS(50000000) - if root goto :null11 - Error("null pointer") - null11: - nti = call :Tree.accept(root v) - PrintIntS(100000000) - if root goto :null12 - Error("null pointer") - null12: - t.1 = call :Tree.Search(root 24) - PrintIntS(t.1) - if root goto :null13 - Error("null pointer") - null13: - t.2 = call :Tree.Search(root 12) - PrintIntS(t.2) - if root goto :null14 - Error("null pointer") - null14: - t.3 = call :Tree.Search(root 16) - PrintIntS(t.3) - if root goto :null15 - Error("null pointer") - null15: - t.4 = call :Tree.Search(root 50) - PrintIntS(t.4) - if root goto :null16 - Error("null pointer") - null16: - t.5 = call :Tree.Search(root 12) - PrintIntS(t.5) - if root goto :null17 - Error("null pointer") - null17: - ntb = call :Tree.Delete(root 12) - if root goto :null18 - Error("null pointer") - null18: - ntb = call :Tree.Print(root) - if root goto :null19 - Error("null pointer") - null19: - t.6 = call :Tree.Search(root 12) - PrintIntS(t.6) - ret 0 - -func Tree.Init(this v_key) - [this+8] = v_key - [this+12] = 0 - [this+16] = 0 - ret 1 - -func Tree.SetRight(this rn) - [this+4] = rn - ret 1 - -func Tree.SetLeft(this ln) - [this+0] = ln - ret 1 - -func Tree.GetRight(this) - t.0 = [this+4] - ret t.0 - -func Tree.GetLeft(this) - t.0 = [this+0] - ret t.0 - -func Tree.GetKey(this) - t.0 = [this+8] - ret t.0 - -func Tree.SetKey(this v_key) - [this+8] = v_key - ret 1 - -func Tree.GetHas_Right(this) - t.0 = [this+16] - ret t.0 - -func Tree.GetHas_Left(this) - t.0 = [this+12] - ret t.0 - -func Tree.SetHas_Left(this val) - [this+12] = val - ret 1 - -func Tree.SetHas_Right(this val) - [this+16] = val - ret 1 - -func Tree.Compare(this num1 num2) - ntb = 0 - nti = Add(num2 1) - t.0 = LtS(num1 num2) - if0 t.0 goto :if1_else - ntb = 0 - goto :if1_end - if1_else: - t.1 = LtS(num1 nti) - if t.1 goto :if2_else - ntb = 0 - goto :if2_end - if2_else: - ntb = 1 - if2_end: - if1_end: - ret ntb - -func Tree.Insert(this v_key) - new_node = HeapAllocZ(24) - if new_node goto :null20 - Error("null pointer") - null20: - ntb = call :Tree.Init(new_node v_key) - current_node = this - cont = 1 - while1_top: - if0 cont goto :while1_end - if current_node goto :null21 - Error("null pointer") - null21: - key_aux = call :Tree.GetKey(current_node) - t.0 = LtS(v_key key_aux) - if0 t.0 goto :if3_else - if current_node goto :null22 - Error("null pointer") - null22: - t.1 = call :Tree.GetHas_Left(current_node) - if0 t.1 goto :if4_else - if current_node goto :null23 - Error("null pointer") - null23: - current_node = call :Tree.GetLeft(current_node) - goto :if4_end - if4_else: - cont = 0 - if current_node goto :null24 - Error("null pointer") - null24: - ntb = call :Tree.SetHas_Left(current_node 1) - if current_node goto :null25 - Error("null pointer") - null25: - ntb = call :Tree.SetLeft(current_node new_node) - if4_end: - goto :if3_end - if3_else: - if current_node goto :null26 - Error("null pointer") - null26: - t.2 = call :Tree.GetHas_Right(current_node) - if0 t.2 goto :if5_else - if current_node goto :null27 - Error("null pointer") - null27: - current_node = call :Tree.GetRight(current_node) - goto :if5_end - if5_else: - cont = 0 - if current_node goto :null28 - Error("null pointer") - null28: - ntb = call :Tree.SetHas_Right(current_node 1) - if current_node goto :null29 - Error("null pointer") - null29: - ntb = call :Tree.SetRight(current_node new_node) - if5_end: - if3_end: - goto :while1_top - while1_end: - ret 1 - -func Tree.Delete(this v_key) - current_node = this - parent_node = this - cont = 1 - found = 0 - is_root = 1 - while2_top: - if0 cont goto :while2_end - if current_node goto :null30 - Error("null pointer") - null30: - key_aux = call :Tree.GetKey(current_node) - t.0 = LtS(v_key key_aux) - if0 t.0 goto :if6_else - if current_node goto :null31 - Error("null pointer") - null31: - t.1 = call :Tree.GetHas_Left(current_node) - if0 t.1 goto :if7_else - parent_node = current_node - if current_node goto :null32 - Error("null pointer") - null32: - current_node = call :Tree.GetLeft(current_node) - goto :if7_end - if7_else: - cont = 0 - if7_end: - goto :if6_end - if6_else: - t.2 = LtS(key_aux v_key) - if0 t.2 goto :if8_else - if current_node goto :null33 - Error("null pointer") - null33: - t.3 = call :Tree.GetHas_Right(current_node) - if0 t.3 goto :if9_else - parent_node = current_node - if current_node goto :null34 - Error("null pointer") - null34: - current_node = call :Tree.GetRight(current_node) - goto :if9_end - if9_else: - cont = 0 - if9_end: - goto :if8_end - if8_else: - if0 is_root goto :if10_else - if current_node goto :null35 - Error("null pointer") - null35: - t.4 = call :Tree.GetHas_Right(current_node) - if t.4 goto :if11_else - if current_node goto :null36 - Error("null pointer") - null36: - t.5 = call :Tree.GetHas_Left(current_node) - if t.5 goto :if11_else - ntb = 1 - goto :if11_end - if11_else: - ntb = call :Tree.Remove(this parent_node current_node) - if11_end: - goto :if10_end - if10_else: - ntb = call :Tree.Remove(this parent_node current_node) - if10_end: - found = 1 - cont = 0 - if8_end: - if6_end: - is_root = 0 - goto :while2_top - while2_end: - ret found - -func Tree.Remove(this p_node c_node) - if c_node goto :null37 - Error("null pointer") - null37: - t.0 = call :Tree.GetHas_Left(c_node) - if0 t.0 goto :if12_else - ntb = call :Tree.RemoveLeft(this p_node c_node) - goto :if12_end - if12_else: - if c_node goto :null38 - Error("null pointer") - null38: - t.1 = call :Tree.GetHas_Right(c_node) - if0 t.1 goto :if13_else - ntb = call :Tree.RemoveRight(this p_node c_node) - goto :if13_end - if13_else: - if c_node goto :null39 - Error("null pointer") - null39: - auxkey1 = call :Tree.GetKey(c_node) - if p_node goto :null40 - Error("null pointer") - null40: - t.2 = call :Tree.GetLeft(p_node) - if t.2 goto :null41 - Error("null pointer") - null41: - auxkey2 = call :Tree.GetKey(t.2) - t.3 = call :Tree.Compare(this auxkey1 auxkey2) - if0 t.3 goto :if14_else - if p_node goto :null42 - Error("null pointer") - null42: - t.4 = [this+20] - ntb = call :Tree.SetLeft(p_node t.4) - if p_node goto :null43 - Error("null pointer") - null43: - ntb = call :Tree.SetHas_Left(p_node 0) - goto :if14_end - if14_else: - if p_node goto :null44 - Error("null pointer") - null44: - t.5 = [this+20] - ntb = call :Tree.SetRight(p_node t.5) - if p_node goto :null45 - Error("null pointer") - null45: - ntb = call :Tree.SetHas_Right(p_node 0) - if14_end: - if13_end: - if12_end: - ret 1 - -func Tree.RemoveRight(this p_node c_node) - while3_top: - if c_node goto :null46 - Error("null pointer") - null46: - t.0 = call :Tree.GetHas_Right(c_node) - if0 t.0 goto :while3_end - if c_node goto :null47 - Error("null pointer") - null47: - if c_node goto :null48 - Error("null pointer") - null48: - t.1 = call :Tree.GetRight(c_node) - if t.1 goto :null49 - Error("null pointer") - null49: - t.2 = call :Tree.GetKey(t.1) - ntb = call :Tree.SetKey(c_node t.2) - p_node = c_node - if c_node goto :null50 - Error("null pointer") - null50: - c_node = call :Tree.GetRight(c_node) - goto :while3_top - while3_end: - if p_node goto :null51 - Error("null pointer") - null51: - t.3 = [this+20] - ntb = call :Tree.SetRight(p_node t.3) - if p_node goto :null52 - Error("null pointer") - null52: - ntb = call :Tree.SetHas_Right(p_node 0) - ret 1 - -func Tree.RemoveLeft(this p_node c_node) - while4_top: - if c_node goto :null53 - Error("null pointer") - null53: - t.0 = call :Tree.GetHas_Left(c_node) - if0 t.0 goto :while4_end - if c_node goto :null54 - Error("null pointer") - null54: - if c_node goto :null55 - Error("null pointer") - null55: - t.1 = call :Tree.GetLeft(c_node) - if t.1 goto :null56 - Error("null pointer") - null56: - t.2 = call :Tree.GetKey(t.1) - ntb = call :Tree.SetKey(c_node t.2) - p_node = c_node - if c_node goto :null57 - Error("null pointer") - null57: - c_node = call :Tree.GetLeft(c_node) - goto :while4_top - while4_end: - if p_node goto :null58 - Error("null pointer") - null58: - t.3 = [this+20] - ntb = call :Tree.SetLeft(p_node t.3) - if p_node goto :null59 - Error("null pointer") - null59: - ntb = call :Tree.SetHas_Left(p_node 0) - ret 1 - -func Tree.Search(this v_key) - current_node = this - cont = 1 - ifound = 0 - while5_top: - if0 cont goto :while5_end - if current_node goto :null60 - Error("null pointer") - null60: - key_aux = call :Tree.GetKey(current_node) - t.0 = LtS(v_key key_aux) - if0 t.0 goto :if15_else - if current_node goto :null61 - Error("null pointer") - null61: - t.1 = call :Tree.GetHas_Left(current_node) - if0 t.1 goto :if16_else - if current_node goto :null62 - Error("null pointer") - null62: - current_node = call :Tree.GetLeft(current_node) - goto :if16_end - if16_else: - cont = 0 - if16_end: - goto :if15_end - if15_else: - t.2 = LtS(key_aux v_key) - if0 t.2 goto :if17_else - if current_node goto :null63 - Error("null pointer") - null63: - t.3 = call :Tree.GetHas_Right(current_node) - if0 t.3 goto :if18_else - if current_node goto :null64 - Error("null pointer") - null64: - current_node = call :Tree.GetRight(current_node) - goto :if18_end - if18_else: - cont = 0 - if18_end: - goto :if17_end - if17_else: - ifound = 1 - cont = 0 - if17_end: - if15_end: - goto :while5_top - while5_end: - ret ifound - -func Tree.Print(this) - current_node = this - ntb = call :Tree.RecPrint(this current_node) - ret 1 - -func Tree.RecPrint(this node) - if node goto :null65 - Error("null pointer") - null65: - t.0 = call :Tree.GetHas_Left(node) - if0 t.0 goto :if19_else - if node goto :null66 - Error("null pointer") - null66: - t.1 = call :Tree.GetLeft(node) - ntb = call :Tree.RecPrint(this t.1) - goto :if19_end - if19_else: - ntb = 1 - if19_end: - if node goto :null67 - Error("null pointer") - null67: - t.2 = call :Tree.GetKey(node) - PrintIntS(t.2) - if node goto :null68 - Error("null pointer") - null68: - t.3 = call :Tree.GetHas_Right(node) - if0 t.3 goto :if20_else - if node goto :null69 - Error("null pointer") - null69: - t.4 = call :Tree.GetRight(node) - ntb = call :Tree.RecPrint(this t.4) - goto :if20_end - if20_else: - ntb = 1 - if20_end: - ret 1 - -func Tree.accept(this v) - PrintIntS(333) - if v goto :null70 - Error("null pointer") - null70: - t.0 = [v] - t.0 = [t.0+0] - nti = call t.0(v this) - ret 0 - -func Visitor.visit(this n) - if n goto :null71 - Error("null pointer") - null71: - t.0 = call :Tree.GetHas_Right(n) - if0 t.0 goto :if21_else - if n goto :null72 - Error("null pointer") - null72: - t.1 = call :Tree.GetRight(n) - [this+8] = t.1 - t.2 = [this+8] - if t.2 goto :null73 - Error("null pointer") - null73: - nti = call :Tree.accept(t.2 this) - goto :if21_end - if21_else: - nti = 0 - if21_end: - if n goto :null74 - Error("null pointer") - null74: - t.3 = call :Tree.GetHas_Left(n) - if0 t.3 goto :if22_else - if n goto :null75 - Error("null pointer") - null75: - t.4 = call :Tree.GetLeft(n) - [this+4] = t.4 - t.5 = [this+4] - if t.5 goto :null76 - Error("null pointer") - null76: - nti = call :Tree.accept(t.5 this) - goto :if22_end - if22_else: - nti = 0 - if22_end: - ret 0 - -func MyVisitor.visit(this n) - if n goto :null77 - Error("null pointer") - null77: - t.0 = call :Tree.GetHas_Right(n) - if0 t.0 goto :if23_else - if n goto :null78 - Error("null pointer") - null78: - t.1 = call :Tree.GetRight(n) - [this+8] = t.1 - t.2 = [this+8] - if t.2 goto :null79 - Error("null pointer") - null79: - nti = call :Tree.accept(t.2 this) - goto :if23_end - if23_else: - nti = 0 - if23_end: - if n goto :null80 - Error("null pointer") - null80: - t.3 = call :Tree.GetKey(n) - PrintIntS(t.3) - if n goto :null81 - Error("null pointer") - null81: - t.4 = call :Tree.GetHas_Left(n) - if0 t.4 goto :if24_else - if n goto :null82 - Error("null pointer") - null82: - t.5 = call :Tree.GetLeft(n) - [this+4] = t.5 - t.6 = [this+4] - if t.6 goto :null83 - Error("null pointer") - null83: - nti = call :Tree.accept(t.6 this) - goto :if24_end - if24_else: - nti = 0 - if24_end: - ret 0 diff --git a/boil/tests/TreeVisitor.vapor b/boil/tests/TreeVisitor.vapor deleted file mode 100644 index d8aa63b..0000000 --- a/boil/tests/TreeVisitor.vapor +++ /dev/null @@ -1,855 +0,0 @@ - -const vmt_TV - :TV.Start - -const vmt_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 - -const vmt_Visitor - :Visitor.visit - -const vmt_MyVisitor - :MyVisitor.visit - - -func Main() - t.0 = HeapAllocZ(4) - [t.0] = :vmt_TV - if t.0 goto :null1 - Error("null pointer") - null1: - t.1 = [t.0] - t.1 = [t.1+0] - t.2 = call t.1(t.0) - PrintIntS(t.2) - ret - -func TV.Start(this) - t.0 = HeapAllocZ(28) - [t.0] = :vmt_Tree - root = t.0 - if root goto :null2 - Error("null pointer") - null2: - t.1 = [root] - t.1 = [t.1+0] - ntb = call t.1(root 16) - if root goto :null3 - Error("null pointer") - null3: - t.2 = [root] - t.2 = [t.2+72] - ntb = call t.2(root) - PrintIntS(100000000) - if root goto :null4 - Error("null pointer") - null4: - t.3 = [root] - t.3 = [t.3+48] - ntb = call t.3(root 8) - if root goto :null5 - Error("null pointer") - null5: - t.4 = [root] - t.4 = [t.4+48] - ntb = call t.4(root 24) - if root goto :null6 - Error("null pointer") - null6: - t.5 = [root] - t.5 = [t.5+48] - ntb = call t.5(root 4) - if root goto :null7 - Error("null pointer") - null7: - t.6 = [root] - t.6 = [t.6+48] - ntb = call t.6(root 12) - if root goto :null8 - Error("null pointer") - null8: - t.7 = [root] - t.7 = [t.7+48] - ntb = call t.7(root 20) - if root goto :null9 - Error("null pointer") - null9: - t.8 = [root] - t.8 = [t.8+48] - ntb = call t.8(root 28) - if root goto :null10 - Error("null pointer") - null10: - t.9 = [root] - t.9 = [t.9+48] - ntb = call t.9(root 14) - if root goto :null11 - Error("null pointer") - null11: - t.10 = [root] - t.10 = [t.10+72] - ntb = call t.10(root) - PrintIntS(100000000) - t.11 = HeapAllocZ(12) - [t.11] = :vmt_MyVisitor - v = t.11 - PrintIntS(50000000) - if root goto :null12 - Error("null pointer") - null12: - t.12 = [root] - t.12 = [t.12+80] - nti = call t.12(root v) - PrintIntS(100000000) - if root goto :null13 - Error("null pointer") - null13: - t.13 = [root] - t.13 = [t.13+68] - t.14 = call t.13(root 24) - PrintIntS(t.14) - if root goto :null14 - Error("null pointer") - null14: - t.15 = [root] - t.15 = [t.15+68] - t.16 = call t.15(root 12) - PrintIntS(t.16) - if root goto :null15 - Error("null pointer") - null15: - t.17 = [root] - t.17 = [t.17+68] - t.18 = call t.17(root 16) - PrintIntS(t.18) - if root goto :null16 - Error("null pointer") - null16: - t.19 = [root] - t.19 = [t.19+68] - t.20 = call t.19(root 50) - PrintIntS(t.20) - if root goto :null17 - Error("null pointer") - null17: - t.21 = [root] - t.21 = [t.21+68] - t.22 = call t.21(root 12) - PrintIntS(t.22) - if root goto :null18 - Error("null pointer") - null18: - t.23 = [root] - t.23 = [t.23+52] - ntb = call t.23(root 12) - if root goto :null19 - Error("null pointer") - null19: - t.24 = [root] - t.24 = [t.24+72] - ntb = call t.24(root) - if root goto :null20 - Error("null pointer") - null20: - t.25 = [root] - t.25 = [t.25+68] - t.26 = call t.25(root 12) - PrintIntS(t.26) - ret 0 - -func Tree.Init(this v_key) - [this+12] = v_key - [this+16] = 0 - [this+20] = 0 - ret 1 - -func Tree.SetRight(this rn) - [this+8] = rn - ret 1 - -func Tree.SetLeft(this ln) - [this+4] = ln - ret 1 - -func Tree.GetRight(this) - t.0 = [this+8] - ret t.0 - -func Tree.GetLeft(this) - t.0 = [this+4] - ret t.0 - -func Tree.GetKey(this) - t.0 = [this+12] - ret t.0 - -func Tree.SetKey(this v_key) - [this+12] = v_key - ret 1 - -func Tree.GetHas_Right(this) - t.0 = [this+20] - ret t.0 - -func Tree.GetHas_Left(this) - t.0 = [this+16] - ret t.0 - -func Tree.SetHas_Left(this val) - [this+16] = val - ret 1 - -func Tree.SetHas_Right(this val) - [this+20] = val - ret 1 - -func Tree.Compare(this num1 num2) - ntb = 0 - nti = Add(num2 1) - t.0 = LtS(num1 num2) - if0 t.0 goto :if1_else - ntb = 0 - goto :if1_end - if1_else: - t.1 = LtS(num1 nti) - t.2 = Sub(1 t.1) - if0 t.2 goto :if2_else - ntb = 0 - goto :if2_end - if2_else: - ntb = 1 - if2_end: - if1_end: - ret ntb - -func Tree.Insert(this v_key) - t.0 = HeapAllocZ(28) - [t.0] = :vmt_Tree - new_node = t.0 - if new_node goto :null21 - Error("null pointer") - null21: - t.1 = [new_node] - t.1 = [t.1+0] - ntb = call t.1(new_node v_key) - current_node = this - cont = 1 - while1_top: - if0 cont goto :while1_end - if current_node goto :null22 - Error("null pointer") - null22: - t.2 = [current_node] - t.2 = [t.2+20] - key_aux = call t.2(current_node) - t.3 = LtS(v_key key_aux) - if0 t.3 goto :if3_else - if current_node goto :null23 - Error("null pointer") - null23: - t.4 = [current_node] - t.4 = [t.4+32] - t.5 = call t.4(current_node) - if0 t.5 goto :if4_else - if current_node goto :null24 - Error("null pointer") - null24: - t.6 = [current_node] - t.6 = [t.6+16] - current_node = call t.6(current_node) - goto :if4_end - if4_else: - cont = 0 - if current_node goto :null25 - Error("null pointer") - null25: - t.7 = [current_node] - t.7 = [t.7+36] - ntb = call t.7(current_node 1) - if current_node goto :null26 - Error("null pointer") - null26: - t.8 = [current_node] - t.8 = [t.8+8] - ntb = call t.8(current_node new_node) - if4_end: - goto :if3_end - if3_else: - if current_node goto :null27 - Error("null pointer") - null27: - t.9 = [current_node] - t.9 = [t.9+28] - t.10 = call t.9(current_node) - if0 t.10 goto :if5_else - if current_node goto :null28 - Error("null pointer") - null28: - t.11 = [current_node] - t.11 = [t.11+12] - current_node = call t.11(current_node) - goto :if5_end - if5_else: - cont = 0 - if current_node goto :null29 - Error("null pointer") - null29: - t.12 = [current_node] - t.12 = [t.12+40] - ntb = call t.12(current_node 1) - if current_node goto :null30 - Error("null pointer") - null30: - t.13 = [current_node] - t.13 = [t.13+4] - ntb = call t.13(current_node new_node) - if5_end: - if3_end: - goto :while1_top - while1_end: - ret 1 - -func Tree.Delete(this v_key) - current_node = this - parent_node = this - cont = 1 - found = 0 - is_root = 1 - while2_top: - if0 cont goto :while2_end - if current_node goto :null31 - Error("null pointer") - null31: - t.0 = [current_node] - t.0 = [t.0+20] - key_aux = call t.0(current_node) - t.1 = LtS(v_key key_aux) - if0 t.1 goto :if6_else - if current_node goto :null32 - Error("null pointer") - null32: - t.2 = [current_node] - t.2 = [t.2+32] - t.3 = call t.2(current_node) - if0 t.3 goto :if7_else - parent_node = current_node - if current_node goto :null33 - Error("null pointer") - null33: - t.4 = [current_node] - t.4 = [t.4+16] - current_node = call t.4(current_node) - goto :if7_end - if7_else: - cont = 0 - if7_end: - goto :if6_end - if6_else: - t.5 = LtS(key_aux v_key) - if0 t.5 goto :if8_else - if current_node goto :null34 - Error("null pointer") - null34: - t.6 = [current_node] - t.6 = [t.6+28] - t.7 = call t.6(current_node) - if0 t.7 goto :if9_else - parent_node = current_node - if current_node goto :null35 - Error("null pointer") - null35: - t.8 = [current_node] - t.8 = [t.8+12] - current_node = call t.8(current_node) - goto :if9_end - if9_else: - cont = 0 - if9_end: - goto :if8_end - if8_else: - if0 is_root goto :if10_else - if current_node goto :null36 - Error("null pointer") - null36: - t.10 = [current_node] - t.10 = [t.10+28] - t.11 = call t.10(current_node) - t.12 = Sub(1 t.11) - if0 t.12 goto :ss1_else - if current_node goto :null37 - Error("null pointer") - null37: - t.13 = [current_node] - t.13 = [t.13+32] - t.14 = call t.13(current_node) - t.9 = Sub(1 t.14) - goto :ss1_end - ss1_else: - t.9 = 0 - ss1_end: - if0 t.9 goto :if11_else - ntb = 1 - goto :if11_end - if11_else: - t.15 = [this] - t.15 = [t.15+56] - ntb = call t.15(this parent_node current_node) - if11_end: - goto :if10_end - if10_else: - t.16 = [this] - t.16 = [t.16+56] - ntb = call t.16(this parent_node current_node) - if10_end: - found = 1 - cont = 0 - if8_end: - if6_end: - is_root = 0 - goto :while2_top - while2_end: - ret found - -func Tree.Remove(this p_node c_node) - if c_node goto :null38 - Error("null pointer") - null38: - t.0 = [c_node] - t.0 = [t.0+32] - t.1 = call t.0(c_node) - if0 t.1 goto :if12_else - t.2 = [this] - t.2 = [t.2+64] - ntb = call t.2(this p_node c_node) - goto :if12_end - if12_else: - if c_node goto :null39 - Error("null pointer") - null39: - t.3 = [c_node] - t.3 = [t.3+28] - t.4 = call t.3(c_node) - if0 t.4 goto :if13_else - t.5 = [this] - t.5 = [t.5+60] - ntb = call t.5(this p_node c_node) - goto :if13_end - if13_else: - if c_node goto :null40 - Error("null pointer") - null40: - t.6 = [c_node] - t.6 = [t.6+20] - auxkey1 = call t.6(c_node) - if p_node goto :null41 - Error("null pointer") - null41: - t.7 = [p_node] - t.7 = [t.7+16] - t.8 = call t.7(p_node) - if t.8 goto :null42 - Error("null pointer") - null42: - t.9 = [t.8] - t.9 = [t.9+20] - auxkey2 = call t.9(t.8) - t.10 = [this] - t.10 = [t.10+44] - t.11 = call t.10(this auxkey1 auxkey2) - if0 t.11 goto :if14_else - if p_node goto :null43 - Error("null pointer") - null43: - t.12 = [p_node] - t.12 = [t.12+8] - t.13 = [this+24] - ntb = call t.12(p_node t.13) - if p_node goto :null44 - Error("null pointer") - null44: - t.14 = [p_node] - t.14 = [t.14+36] - ntb = call t.14(p_node 0) - goto :if14_end - if14_else: - if p_node goto :null45 - Error("null pointer") - null45: - t.15 = [p_node] - t.15 = [t.15+4] - t.16 = [this+24] - ntb = call t.15(p_node t.16) - if p_node goto :null46 - Error("null pointer") - null46: - t.17 = [p_node] - t.17 = [t.17+40] - ntb = call t.17(p_node 0) - if14_end: - if13_end: - if12_end: - ret 1 - -func Tree.RemoveRight(this p_node c_node) - while3_top: - if c_node goto :null47 - Error("null pointer") - null47: - t.0 = [c_node] - t.0 = [t.0+28] - t.1 = call t.0(c_node) - if0 t.1 goto :while3_end - if c_node goto :null48 - Error("null pointer") - null48: - t.2 = [c_node] - t.2 = [t.2+24] - if c_node goto :null49 - Error("null pointer") - null49: - t.3 = [c_node] - t.3 = [t.3+12] - t.4 = call t.3(c_node) - if t.4 goto :null50 - Error("null pointer") - null50: - t.5 = [t.4] - t.5 = [t.5+20] - t.6 = call t.5(t.4) - ntb = call t.2(c_node t.6) - p_node = c_node - if c_node goto :null51 - Error("null pointer") - null51: - t.7 = [c_node] - t.7 = [t.7+12] - c_node = call t.7(c_node) - goto :while3_top - while3_end: - if p_node goto :null52 - Error("null pointer") - null52: - t.8 = [p_node] - t.8 = [t.8+4] - t.9 = [this+24] - ntb = call t.8(p_node t.9) - if p_node goto :null53 - Error("null pointer") - null53: - t.10 = [p_node] - t.10 = [t.10+40] - ntb = call t.10(p_node 0) - ret 1 - -func Tree.RemoveLeft(this p_node c_node) - while4_top: - if c_node goto :null54 - Error("null pointer") - null54: - t.0 = [c_node] - t.0 = [t.0+32] - t.1 = call t.0(c_node) - if0 t.1 goto :while4_end - if c_node goto :null55 - Error("null pointer") - null55: - t.2 = [c_node] - t.2 = [t.2+24] - if c_node goto :null56 - Error("null pointer") - null56: - t.3 = [c_node] - t.3 = [t.3+16] - t.4 = call t.3(c_node) - if t.4 goto :null57 - Error("null pointer") - null57: - t.5 = [t.4] - t.5 = [t.5+20] - t.6 = call t.5(t.4) - ntb = call t.2(c_node t.6) - p_node = c_node - if c_node goto :null58 - Error("null pointer") - null58: - t.7 = [c_node] - t.7 = [t.7+16] - c_node = call t.7(c_node) - goto :while4_top - while4_end: - if p_node goto :null59 - Error("null pointer") - null59: - t.8 = [p_node] - t.8 = [t.8+8] - t.9 = [this+24] - ntb = call t.8(p_node t.9) - if p_node goto :null60 - Error("null pointer") - null60: - t.10 = [p_node] - t.10 = [t.10+36] - ntb = call t.10(p_node 0) - ret 1 - -func Tree.Search(this v_key) - current_node = this - cont = 1 - ifound = 0 - while5_top: - if0 cont goto :while5_end - if current_node goto :null61 - Error("null pointer") - null61: - t.0 = [current_node] - t.0 = [t.0+20] - key_aux = call t.0(current_node) - t.1 = LtS(v_key key_aux) - if0 t.1 goto :if15_else - if current_node goto :null62 - Error("null pointer") - null62: - t.2 = [current_node] - t.2 = [t.2+32] - t.3 = call t.2(current_node) - if0 t.3 goto :if16_else - if current_node goto :null63 - Error("null pointer") - null63: - t.4 = [current_node] - t.4 = [t.4+16] - current_node = call t.4(current_node) - goto :if16_end - if16_else: - cont = 0 - if16_end: - goto :if15_end - if15_else: - t.5 = LtS(key_aux v_key) - if0 t.5 goto :if17_else - if current_node goto :null64 - Error("null pointer") - null64: - t.6 = [current_node] - t.6 = [t.6+28] - t.7 = call t.6(current_node) - if0 t.7 goto :if18_else - if current_node goto :null65 - Error("null pointer") - null65: - t.8 = [current_node] - t.8 = [t.8+12] - current_node = call t.8(current_node) - goto :if18_end - if18_else: - cont = 0 - if18_end: - goto :if17_end - if17_else: - ifound = 1 - cont = 0 - if17_end: - if15_end: - goto :while5_top - while5_end: - ret ifound - -func Tree.Print(this) - current_node = this - t.0 = [this] - t.0 = [t.0+76] - ntb = call t.0(this current_node) - ret 1 - -func Tree.RecPrint(this node) - if node goto :null66 - Error("null pointer") - null66: - t.0 = [node] - t.0 = [t.0+32] - t.1 = call t.0(node) - if0 t.1 goto :if19_else - t.2 = [this] - t.2 = [t.2+76] - if node goto :null67 - Error("null pointer") - null67: - t.3 = [node] - t.3 = [t.3+16] - t.4 = call t.3(node) - ntb = call t.2(this t.4) - goto :if19_end - if19_else: - ntb = 1 - if19_end: - if node goto :null68 - Error("null pointer") - null68: - t.5 = [node] - t.5 = [t.5+20] - t.6 = call t.5(node) - PrintIntS(t.6) - if node goto :null69 - Error("null pointer") - null69: - t.7 = [node] - t.7 = [t.7+28] - t.8 = call t.7(node) - if0 t.8 goto :if20_else - t.9 = [this] - t.9 = [t.9+76] - if node goto :null70 - Error("null pointer") - null70: - t.10 = [node] - t.10 = [t.10+12] - t.11 = call t.10(node) - ntb = call t.9(this t.11) - goto :if20_end - if20_else: - ntb = 1 - if20_end: - ret 1 - -func Tree.accept(this v) - PrintIntS(333) - if v goto :null71 - Error("null pointer") - null71: - t.0 = [v] - t.0 = [t.0+0] - nti = call t.0(v this) - ret 0 - -func Visitor.visit(this n) - if n goto :null72 - Error("null pointer") - null72: - t.0 = [n] - t.0 = [t.0+28] - t.1 = call t.0(n) - if0 t.1 goto :if21_else - if n goto :null73 - Error("null pointer") - null73: - t.2 = [n] - t.2 = [t.2+12] - t.3 = call t.2(n) - [this+8] = t.3 - t.4 = [this+8] - if t.4 goto :null74 - Error("null pointer") - null74: - t.5 = [t.4] - t.5 = [t.5+80] - nti = call t.5(t.4 this) - goto :if21_end - if21_else: - nti = 0 - if21_end: - if n goto :null75 - Error("null pointer") - null75: - t.6 = [n] - t.6 = [t.6+32] - t.7 = call t.6(n) - if0 t.7 goto :if22_else - if n goto :null76 - Error("null pointer") - null76: - t.8 = [n] - t.8 = [t.8+16] - t.9 = call t.8(n) - [this+4] = t.9 - t.10 = [this+4] - if t.10 goto :null77 - Error("null pointer") - null77: - t.11 = [t.10] - t.11 = [t.11+80] - nti = call t.11(t.10 this) - goto :if22_end - if22_else: - nti = 0 - if22_end: - ret 0 - -func MyVisitor.visit(this n) - if n goto :null78 - Error("null pointer") - null78: - t.0 = [n] - t.0 = [t.0+28] - t.1 = call t.0(n) - if0 t.1 goto :if23_else - if n goto :null79 - Error("null pointer") - null79: - t.2 = [n] - t.2 = [t.2+12] - t.3 = call t.2(n) - [this+8] = t.3 - t.4 = [this+8] - if t.4 goto :null80 - Error("null pointer") - null80: - t.5 = [t.4] - t.5 = [t.5+80] - nti = call t.5(t.4 this) - goto :if23_end - if23_else: - nti = 0 - if23_end: - if n goto :null81 - Error("null pointer") - null81: - t.6 = [n] - t.6 = [t.6+20] - t.7 = call t.6(n) - PrintIntS(t.7) - if n goto :null82 - Error("null pointer") - null82: - t.8 = [n] - t.8 = [t.8+32] - t.9 = call t.8(n) - if0 t.9 goto :if24_else - if n goto :null83 - Error("null pointer") - null83: - t.10 = [n] - t.10 = [t.10+16] - t.11 = call t.10(n) - [this+4] = t.11 - t.12 = [this+4] - if t.12 goto :null84 - Error("null pointer") - null84: - t.13 = [t.12] - t.13 = [t.13+80] - nti = call t.13(t.12 this) - goto :if24_end - if24_else: - nti = 0 - if24_end: - ret 0 diff --git a/boil/tests/ex1.java b/boil/tests/ex1.java deleted file mode 100644 index 22f0aa0..0000000 --- a/boil/tests/ex1.java +++ /dev/null @@ -1,11 +0,0 @@ -class ex1{ - public static void main(String[] a){ - System.out.println(1); - } -} - -class A { - public int foo() { - return 1 ; - } -} diff --git a/boil/tests/ex1.vapor b/boil/tests/ex1.vapor deleted file mode 100644 index bcfb38c..0000000 --- a/boil/tests/ex1.vapor +++ /dev/null @@ -1,5 +0,0 @@ -const functable_A - :A_foo - -func A_foo(this) - ret
\ No newline at end of file diff --git a/boil/tests/ex2.vapor b/boil/tests/ex2.vapor deleted file mode 100644 index 25811b3..0000000 --- a/boil/tests/ex2.vapor +++ /dev/null @@ -1,11 +0,0 @@ -const functable_A - :A_foo - -const functable_B - :B_bar - -func A_foo (this) - ret - -func B_bar(this) - ret
\ No newline at end of file diff --git a/boil/tests/ex30.vapor b/boil/tests/ex30.vapor deleted file mode 100644 index 200baee..0000000 --- a/boil/tests/ex30.vapor +++ /dev/null @@ -1,3 +0,0 @@ -func Main() - - ret
\ No newline at end of file diff --git a/boil/tests/ex31.java b/boil/tests/ex31.java index d5a6980..d276e68 100644 --- a/boil/tests/ex31.java +++ b/boil/tests/ex31.java @@ -1,5 +1,5 @@ class ex31 { - public static void main(String[] a) { + public static void main(String[] z) { A a ; a = new A() ; } diff --git a/boil/tests/ex32.java b/boil/tests/ex32.java index 2527e04..4ab80d6 100644 --- a/boil/tests/ex32.java +++ b/boil/tests/ex32.java @@ -1,5 +1,5 @@ class ex32 { - public static void main(String[] a) { + public static void main(String[] z) { A a ; a = new A() ; System.out.println(a.foo(12, 14, 15, 12 + 23)) ; diff --git a/boil/tests/ex33.java b/boil/tests/ex33.java index 3325ea8..d0eb045 100644 --- a/boil/tests/ex33.java +++ b/boil/tests/ex33.java @@ -1,5 +1,5 @@ class ex33 { - public static void main(String[] a) { + public static void main(String[] z) { A a ; a = new A() ; System.out.println(a.bar(0-1, 400, 6*7)) ; @@ -8,6 +8,9 @@ class ex33 { } class A { + + int o ; + public int foo(int a, int b) { return 22 ; } diff --git a/boil/tests/ex34.java b/boil/tests/ex34.java new file mode 100644 index 0000000..eb5b18f --- /dev/null +++ b/boil/tests/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/boil/tests/ex35.java b/boil/tests/ex35.java new file mode 100644 index 0000000..32c855b --- /dev/null +++ b/boil/tests/ex35.java @@ -0,0 +1,13 @@ +class ex35{ + public static void main(String[] a){ + System.out.println(new Fac().ComputeFac(10)); + } +} + +class Fac { + public int ComputeFac(int num){ + int num_aux ; + num_aux = 4 ; + return num_aux ; + } +} |