From 39f77cc54ea08cd1feac8796aaa617d00a35f835 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 11 Apr 2015 22:24:33 -0700 Subject: 1050 --- .../string-equal-common-lengths-but-distinct | 64 +++++++++--------- cpp/.traces/string-equal-distinct-lengths | 6 +- cpp/.traces/string-equal-identical | 78 ++++++++++++---------- cpp/.traces/string-equal-reflexive | 78 ++++++++++++---------- cpp/.traces/string-equal-with-empty | 6 +- cpp/040string.mu | 2 + 6 files changed, 126 insertions(+), 108 deletions(-) diff --git a/cpp/.traces/string-equal-common-lengths-but-distinct b/cpp/.traces/string-equal-common-lengths-but-distinct index ac5a12ce..58112874 100644 --- a/cpp/.traces/string-equal-common-lengths-but-distinct +++ b/cpp/.traces/string-equal-common-lengths-but-distinct @@ -46,32 +46,36 @@ run/0: instruction string-equal/4 mem/0: location 1042 is 1034 mem/0: storing 3 in location 1043 run/0: instruction string-equal/6 +string-equal/0: comparing lengths +run/0: instruction string-equal/7 run/0: ingredient 0 is a-len mem/0: location 1041 is 3 run/0: ingredient 1 is b-len mem/0: location 1043 is 3 run/0: product 0 is 1 mem/0: storing 1 in location 1044 -run/0: instruction string-equal/7 +run/0: instruction string-equal/8 mem/0: location 1044 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 9 -run/0: instruction string-equal/10 +run/0: jumping to instruction 10 +run/0: instruction string-equal/11 +string-equal/0: comparing characters +run/0: instruction string-equal/12 run/0: ingredient 0 is 0 mem/0: storing 0 in location 1045 -run/0: instruction string-equal/12 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1045 is 0 run/0: ingredient 1 is a-len mem/0: location 1041 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1046 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1046 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1040 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -81,7 +85,7 @@ run/0: its type is 8 mem/0: location 1031 is 97 run/0: product 0 is 97 mem/0: storing 97 in location 1047 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1042 is 1034 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -91,39 +95,39 @@ run/0: its type is 8 mem/0: location 1035 is 97 run/0: product 0 is 97 mem/0: storing 97 in location 1048 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1047 is 97 run/0: ingredient 1 is b2 mem/0: location 1048 is 97 run/0: product 0 is 1 mem/0: storing 1 in location 1049 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1049 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 20 -run/0: instruction string-equal/21 +run/0: jumping to instruction 22 +run/0: instruction string-equal/23 run/0: ingredient 0 is i mem/0: location 1045 is 0 run/0: ingredient 1 is 1 run/0: product 0 is 1 mem/0: storing 1 in location 1045 -run/0: instruction string-equal/22 +run/0: instruction string-equal/24 run/0: ingredient 0 is -11 -run/0: pc now 11 -run/0: instruction string-equal/12 +run/0: pc now 13 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1045 is 1 run/0: ingredient 1 is a-len mem/0: location 1041 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1046 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1046 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1040 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -133,7 +137,7 @@ run/0: its type is 8 mem/0: location 1032 is 98 run/0: product 0 is 98 mem/0: storing 98 in location 1047 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1042 is 1034 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -143,39 +147,39 @@ run/0: its type is 8 mem/0: location 1036 is 98 run/0: product 0 is 98 mem/0: storing 98 in location 1048 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1047 is 98 run/0: ingredient 1 is b2 mem/0: location 1048 is 98 run/0: product 0 is 1 mem/0: storing 1 in location 1049 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1049 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 20 -run/0: instruction string-equal/21 +run/0: jumping to instruction 22 +run/0: instruction string-equal/23 run/0: ingredient 0 is i mem/0: location 1045 is 1 run/0: ingredient 1 is 1 run/0: product 0 is 2 mem/0: storing 2 in location 1045 -run/0: instruction string-equal/22 +run/0: instruction string-equal/24 run/0: ingredient 0 is -11 -run/0: pc now 11 -run/0: instruction string-equal/12 +run/0: pc now 13 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1045 is 2 run/0: ingredient 1 is a-len mem/0: location 1041 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1046 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1046 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1040 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -185,7 +189,7 @@ run/0: its type is 8 mem/0: location 1033 is 99 run/0: product 0 is 99 mem/0: storing 99 in location 1047 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1042 is 1034 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -195,17 +199,17 @@ run/0: its type is 8 mem/0: location 1037 is 100 run/0: product 0 is 100 mem/0: storing 100 in location 1048 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1047 is 99 run/0: ingredient 1 is b2 mem/0: location 1048 is 100 run/0: product 0 is 0 mem/0: storing 0 in location 1049 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1049 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/19 +run/0: instruction string-equal/21 run/0: result 0 is 0 mem/0: storing 0 in location 3 diff --git a/cpp/.traces/string-equal-distinct-lengths b/cpp/.traces/string-equal-distinct-lengths index 98444b85..6008eaf4 100644 --- a/cpp/.traces/string-equal-distinct-lengths +++ b/cpp/.traces/string-equal-distinct-lengths @@ -46,16 +46,18 @@ run/0: instruction string-equal/4 mem/0: location 1043 is 1034 mem/0: storing 4 in location 1044 run/0: instruction string-equal/6 +string-equal/0: comparing lengths +run/0: instruction string-equal/7 run/0: ingredient 0 is a-len mem/0: location 1042 is 3 run/0: ingredient 1 is b-len mem/0: location 1044 is 4 run/0: product 0 is 0 mem/0: storing 0 in location 1045 -run/0: instruction string-equal/7 +run/0: instruction string-equal/8 mem/0: location 1045 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/8 +run/0: instruction string-equal/9 run/0: result 0 is 0 mem/0: storing 0 in location 3 diff --git a/cpp/.traces/string-equal-identical b/cpp/.traces/string-equal-identical index 4a878121..ad2db713 100644 --- a/cpp/.traces/string-equal-identical +++ b/cpp/.traces/string-equal-identical @@ -46,32 +46,36 @@ run/0: instruction string-equal/4 mem/0: location 1042 is 1034 mem/0: storing 3 in location 1043 run/0: instruction string-equal/6 +string-equal/0: comparing lengths +run/0: instruction string-equal/7 run/0: ingredient 0 is a-len mem/0: location 1041 is 3 run/0: ingredient 1 is b-len mem/0: location 1043 is 3 run/0: product 0 is 1 mem/0: storing 1 in location 1044 -run/0: instruction string-equal/7 +run/0: instruction string-equal/8 mem/0: location 1044 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 9 -run/0: instruction string-equal/10 +run/0: jumping to instruction 10 +run/0: instruction string-equal/11 +string-equal/0: comparing characters +run/0: instruction string-equal/12 run/0: ingredient 0 is 0 mem/0: storing 0 in location 1045 -run/0: instruction string-equal/12 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1045 is 0 run/0: ingredient 1 is a-len mem/0: location 1041 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1046 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1046 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1040 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -81,7 +85,7 @@ run/0: its type is 8 mem/0: location 1031 is 97 run/0: product 0 is 97 mem/0: storing 97 in location 1047 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1042 is 1034 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -91,39 +95,39 @@ run/0: its type is 8 mem/0: location 1035 is 97 run/0: product 0 is 97 mem/0: storing 97 in location 1048 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1047 is 97 run/0: ingredient 1 is b2 mem/0: location 1048 is 97 run/0: product 0 is 1 mem/0: storing 1 in location 1049 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1049 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 20 -run/0: instruction string-equal/21 +run/0: jumping to instruction 22 +run/0: instruction string-equal/23 run/0: ingredient 0 is i mem/0: location 1045 is 0 run/0: ingredient 1 is 1 run/0: product 0 is 1 mem/0: storing 1 in location 1045 -run/0: instruction string-equal/22 +run/0: instruction string-equal/24 run/0: ingredient 0 is -11 -run/0: pc now 11 -run/0: instruction string-equal/12 +run/0: pc now 13 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1045 is 1 run/0: ingredient 1 is a-len mem/0: location 1041 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1046 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1046 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1040 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -133,7 +137,7 @@ run/0: its type is 8 mem/0: location 1032 is 98 run/0: product 0 is 98 mem/0: storing 98 in location 1047 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1042 is 1034 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -143,39 +147,39 @@ run/0: its type is 8 mem/0: location 1036 is 98 run/0: product 0 is 98 mem/0: storing 98 in location 1048 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1047 is 98 run/0: ingredient 1 is b2 mem/0: location 1048 is 98 run/0: product 0 is 1 mem/0: storing 1 in location 1049 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1049 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 20 -run/0: instruction string-equal/21 +run/0: jumping to instruction 22 +run/0: instruction string-equal/23 run/0: ingredient 0 is i mem/0: location 1045 is 1 run/0: ingredient 1 is 1 run/0: product 0 is 2 mem/0: storing 2 in location 1045 -run/0: instruction string-equal/22 +run/0: instruction string-equal/24 run/0: ingredient 0 is -11 -run/0: pc now 11 -run/0: instruction string-equal/12 +run/0: pc now 13 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1045 is 2 run/0: ingredient 1 is a-len mem/0: location 1041 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1046 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1046 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1040 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -185,7 +189,7 @@ run/0: its type is 8 mem/0: location 1033 is 99 run/0: product 0 is 99 mem/0: storing 99 in location 1047 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1042 is 1034 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -195,39 +199,39 @@ run/0: its type is 8 mem/0: location 1037 is 99 run/0: product 0 is 99 mem/0: storing 99 in location 1048 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1047 is 99 run/0: ingredient 1 is b2 mem/0: location 1048 is 99 run/0: product 0 is 1 mem/0: storing 1 in location 1049 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1049 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 20 -run/0: instruction string-equal/21 +run/0: jumping to instruction 22 +run/0: instruction string-equal/23 run/0: ingredient 0 is i mem/0: location 1045 is 2 run/0: ingredient 1 is 1 run/0: product 0 is 3 mem/0: storing 3 in location 1045 -run/0: instruction string-equal/22 +run/0: instruction string-equal/24 run/0: ingredient 0 is -11 -run/0: pc now 11 -run/0: instruction string-equal/12 +run/0: pc now 13 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1045 is 3 run/0: ingredient 1 is a-len mem/0: location 1041 is 3 run/0: product 0 is 1 mem/0: storing 1 in location 1046 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1046 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 23 -run/0: instruction string-equal/24 +run/0: jumping to instruction 25 +run/0: instruction string-equal/26 run/0: result 0 is 1 mem/0: storing 1 in location 3 diff --git a/cpp/.traces/string-equal-reflexive b/cpp/.traces/string-equal-reflexive index 11d0aadf..be1548bb 100644 --- a/cpp/.traces/string-equal-reflexive +++ b/cpp/.traces/string-equal-reflexive @@ -38,32 +38,36 @@ run/0: instruction string-equal/4 mem/0: location 1038 is 1030 mem/0: storing 3 in location 1039 run/0: instruction string-equal/6 +string-equal/0: comparing lengths +run/0: instruction string-equal/7 run/0: ingredient 0 is a-len mem/0: location 1037 is 3 run/0: ingredient 1 is b-len mem/0: location 1039 is 3 run/0: product 0 is 1 mem/0: storing 1 in location 1040 -run/0: instruction string-equal/7 +run/0: instruction string-equal/8 mem/0: location 1040 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 9 -run/0: instruction string-equal/10 +run/0: jumping to instruction 10 +run/0: instruction string-equal/11 +string-equal/0: comparing characters +run/0: instruction string-equal/12 run/0: ingredient 0 is 0 mem/0: storing 0 in location 1041 -run/0: instruction string-equal/12 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1041 is 0 run/0: ingredient 1 is a-len mem/0: location 1037 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1042 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1042 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1036 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -73,7 +77,7 @@ run/0: its type is 8 mem/0: location 1031 is 97 run/0: product 0 is 97 mem/0: storing 97 in location 1043 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1038 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -83,39 +87,39 @@ run/0: its type is 8 mem/0: location 1031 is 97 run/0: product 0 is 97 mem/0: storing 97 in location 1044 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1043 is 97 run/0: ingredient 1 is b2 mem/0: location 1044 is 97 run/0: product 0 is 1 mem/0: storing 1 in location 1045 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1045 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 20 -run/0: instruction string-equal/21 +run/0: jumping to instruction 22 +run/0: instruction string-equal/23 run/0: ingredient 0 is i mem/0: location 1041 is 0 run/0: ingredient 1 is 1 run/0: product 0 is 1 mem/0: storing 1 in location 1041 -run/0: instruction string-equal/22 +run/0: instruction string-equal/24 run/0: ingredient 0 is -11 -run/0: pc now 11 -run/0: instruction string-equal/12 +run/0: pc now 13 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1041 is 1 run/0: ingredient 1 is a-len mem/0: location 1037 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1042 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1042 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1036 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -125,7 +129,7 @@ run/0: its type is 8 mem/0: location 1032 is 98 run/0: product 0 is 98 mem/0: storing 98 in location 1043 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1038 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -135,39 +139,39 @@ run/0: its type is 8 mem/0: location 1032 is 98 run/0: product 0 is 98 mem/0: storing 98 in location 1044 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1043 is 98 run/0: ingredient 1 is b2 mem/0: location 1044 is 98 run/0: product 0 is 1 mem/0: storing 1 in location 1045 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1045 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 20 -run/0: instruction string-equal/21 +run/0: jumping to instruction 22 +run/0: instruction string-equal/23 run/0: ingredient 0 is i mem/0: location 1041 is 1 run/0: ingredient 1 is 1 run/0: product 0 is 2 mem/0: storing 2 in location 1041 -run/0: instruction string-equal/22 +run/0: instruction string-equal/24 run/0: ingredient 0 is -11 -run/0: pc now 11 -run/0: instruction string-equal/12 +run/0: pc now 13 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1041 is 2 run/0: ingredient 1 is a-len mem/0: location 1037 is 3 run/0: product 0 is 0 mem/0: storing 0 in location 1042 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1042 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/14 +run/0: instruction string-equal/16 run/0: ingredient 0 is {name: "a", value: 1, type: 2-5-8, properties: ["a": "address":"array":"character", "deref": ]} mem/0: location 1036 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -177,7 +181,7 @@ run/0: its type is 8 mem/0: location 1033 is 99 run/0: product 0 is 99 mem/0: storing 99 in location 1043 -run/0: instruction string-equal/15 +run/0: instruction string-equal/17 run/0: ingredient 0 is {name: "b", value: 3, type: 2-5-8, properties: ["b": "address":"array":"character", "deref": ]} mem/0: location 1038 is 1030 run/0: ingredient 1 is {name: "i", value: 6, type: 1, properties: ["i": "integer"]} @@ -187,39 +191,39 @@ run/0: its type is 8 mem/0: location 1033 is 99 run/0: product 0 is 99 mem/0: storing 99 in location 1044 -run/0: instruction string-equal/17 +run/0: instruction string-equal/19 run/0: ingredient 0 is a2 mem/0: location 1043 is 99 run/0: ingredient 1 is b2 mem/0: location 1044 is 99 run/0: product 0 is 1 mem/0: storing 1 in location 1045 -run/0: instruction string-equal/18 +run/0: instruction string-equal/20 mem/0: location 1045 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 20 -run/0: instruction string-equal/21 +run/0: jumping to instruction 22 +run/0: instruction string-equal/23 run/0: ingredient 0 is i mem/0: location 1041 is 2 run/0: ingredient 1 is 1 run/0: product 0 is 3 mem/0: storing 3 in location 1041 -run/0: instruction string-equal/22 +run/0: instruction string-equal/24 run/0: ingredient 0 is -11 -run/0: pc now 11 -run/0: instruction string-equal/12 +run/0: pc now 13 +run/0: instruction string-equal/14 run/0: ingredient 0 is i mem/0: location 1041 is 3 run/0: ingredient 1 is a-len mem/0: location 1037 is 3 run/0: product 0 is 1 mem/0: storing 1 in location 1042 -run/0: instruction string-equal/13 +run/0: instruction string-equal/15 mem/0: location 1042 is 1 run/0: ingredient 0 is 1 run/0: ingredient 1 is -run/0: jumping to instruction 23 -run/0: instruction string-equal/24 +run/0: jumping to instruction 25 +run/0: instruction string-equal/26 run/0: result 0 is 1 mem/0: storing 1 in location 3 diff --git a/cpp/.traces/string-equal-with-empty b/cpp/.traces/string-equal-with-empty index 12dcd23f..13f64aac 100644 --- a/cpp/.traces/string-equal-with-empty +++ b/cpp/.traces/string-equal-with-empty @@ -46,16 +46,18 @@ run/0: instruction string-equal/4 mem/0: location 1040 is 1031 mem/0: storing 4 in location 1041 run/0: instruction string-equal/6 +string-equal/0: comparing lengths +run/0: instruction string-equal/7 run/0: ingredient 0 is a-len mem/0: location 1039 is 0 run/0: ingredient 1 is b-len mem/0: location 1041 is 4 run/0: product 0 is 0 mem/0: storing 0 in location 1042 -run/0: instruction string-equal/7 +run/0: instruction string-equal/8 mem/0: location 1042 is 0 run/0: ingredient 0 is 0 run/0: jump-if fell through -run/0: instruction string-equal/8 +run/0: instruction string-equal/9 run/0: result 0 is 0 mem/0: storing 0 in location 3 diff --git a/cpp/040string.mu b/cpp/040string.mu index 17608e5f..b42fbc9c 100644 --- a/cpp/040string.mu +++ b/cpp/040string.mu @@ -6,11 +6,13 @@ recipe string-equal [ b-len:integer <- length b:address:array:character/deref # compare lengths { + trace [string-equal], [comparing lengths] length-equal?:boolean <- equal a-len:integer, b-len:integer break-if length-equal?:boolean reply 0:literal } # compare each corresponding character + trace [string-equal], [comparing characters] i:integer <- copy 0:literal { done?:boolean <- greater-or-equal i:integer, a-len:integer -- cgit 1.4.1-2-gfad0 ref='#n667'>667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938