diff options
-rw-r--r-- | cpp/.traces/interpolate-at-end | 760 | ||||
-rw-r--r-- | cpp/.traces/interpolate-at-start | 741 | ||||
-rw-r--r-- | cpp/.traces/interpolate-works | 577 | ||||
-rw-r--r-- | cpp/060string.mu | 157 |
4 files changed, 2235 insertions, 0 deletions
diff --git a/cpp/.traces/interpolate-at-end b/cpp/.traces/interpolate-at-end new file mode 100644 index 00000000..5a59322e --- /dev/null +++ b/cpp/.traces/interpolate-at-end @@ -0,0 +1,760 @@ +parse/0: instruction: 35 +parse/0: ingredient: {name: "hello, _", value: 0, type: 0, properties: ["hello, _": "literal-string"]} +parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} +parse/0: instruction: 35 +parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} +parse/0: product: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} +parse/0: instruction: 107 +parse/0: ingredient: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} +parse/0: ingredient: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} +parse/0: product: {name: "3", value: 0, type: 2-5-4, properties: ["3": "address":"array":"character", "raw": ]} +parse/0: instruction: 1 +parse/0: ingredient: {name: "3", value: 0, type: 2-5-4, properties: ["3": "address":"array":"character", "raw": , "deref": ]} +parse/0: product: {name: "4", value: 0, type: 5-4, properties: ["4": "array":"character", "raw": ]} +new/0: hello, _ -> 0 +new/0: abc -> 0 +after-brace/0: recipe test-interpolate-at-end +after-brace/0: new ... +after-brace/0: new ... +after-brace/0: interpolate ... +after-brace/0: copy ... +run/0: instruction test-interpolate-at-end/0 +mem/0: storing 1000 in location 1 +run/0: instruction test-interpolate-at-end/1 +mem/0: storing 1009 in location 2 +run/0: instruction test-interpolate-at-end/2 +mem/0: location 1 is 1000 +mem/0: location 2 is 1009 +run/0: instruction interpolate/0 +mem/0: new alloc: 1013 +mem/0: array size is 60 +run/0: instruction interpolate/1 +run/0: product 0 is 1000 +mem/0: storing 1000 in location 1015 +run/0: instruction interpolate/2 +mem/0: location 1015 is 1000 +mem/0: storing 8 in location 1016 +run/0: instruction interpolate/3 +run/0: ingredient 0 is tem-len +mem/0: location 1016 is 8 +mem/0: storing 8 in location 1017 +run/0: instruction interpolate/5 +run/0: product 0 is 1009 +mem/0: storing 1009 in location 1018 +mem/0: storing 1 in location 1019 +run/0: instruction interpolate/6 +mem/0: location 1019 is 1 +run/0: ingredient 0 is 1 +run/0: jump-unless fell through +run/0: instruction interpolate/7 +mem/0: location 1018 is 1009 +mem/0: storing 3 in location 1020 +run/0: instruction interpolate/8 +run/0: ingredient 0 is result-len +mem/0: location 1017 is 8 +run/0: ingredient 1 is a-len +mem/0: location 1020 is 3 +run/0: product 0 is 11 +mem/0: storing 11 in location 1017 +run/0: instruction interpolate/9 +run/0: ingredient 0 is result-len +mem/0: location 1017 is 11 +run/0: ingredient 1 is 1 +run/0: product 0 is 10 +mem/0: storing 10 in location 1017 +run/0: instruction interpolate/10 +run/0: ingredient 0 is -6 +run/0: pc now 4 +run/0: instruction interpolate/5 +mem/0: storing 0 in location 1019 +run/0: instruction interpolate/6 +mem/0: location 1019 is 0 +run/0: ingredient 0 is 0 +run/0: ingredient 1 is +run/0: jumping to instruction 11 +run/0: instruction interpolate/12 +run/0: instruction interpolate/13 +run/0: product 0 is 1000 +run/0: instruction interpolate/14 +mem/0: new alloc: 1073 +mem/0: storing 1073 in location 1021 +mem/0: location 1017 is 10 +mem/0: array size is 10 +run/0: instruction interpolate/15 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1022 +run/0: instruction interpolate/16 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1023 +run/0: instruction interpolate/18 +run/0: product 0 is 1009 +mem/0: storing 1009 in location 1018 +mem/0: storing 1 in location 1019 +run/0: instruction interpolate/19 +mem/0: location 1019 is 1 +run/0: ingredient 0 is 1 +run/0: jump-unless fell through +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1023 is 0 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/22 +mem/0: location 1024 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1023 is 0 +run/0: address to copy is 1001 +run/0: its type is 4 +mem/0: location 1001 is 104 +run/0: product 0 is 104 +mem/0: storing 104 in location 1025 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1025 is 104 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/25 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 0 +run/0: address to copy is 1074 +run/0: product 0 is 1074 +mem/0: storing 1074 in location 1027 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1025 is 104 +mem/0: location 1027 is 1074 +mem/0: storing 104 in location 1074 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1023 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1023 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1022 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1023 is 1 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/22 +mem/0: location 1024 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1023 is 1 +run/0: address to copy is 1002 +run/0: its type is 4 +mem/0: location 1002 is 101 +run/0: product 0 is 101 +mem/0: storing 101 in location 1025 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1025 is 101 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/25 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 1 +run/0: address to copy is 1075 +run/0: product 0 is 1075 +mem/0: storing 1075 in location 1027 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1025 is 101 +mem/0: location 1027 is 1075 +mem/0: storing 101 in location 1075 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1023 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1023 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1022 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1023 is 2 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/22 +mem/0: location 1024 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1023 is 2 +run/0: address to copy is 1003 +run/0: its type is 4 +mem/0: location 1003 is 108 +run/0: product 0 is 108 +mem/0: storing 108 in location 1025 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1025 is 108 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/25 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 2 +run/0: address to copy is 1076 +run/0: product 0 is 1076 +mem/0: storing 1076 in location 1027 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1025 is 108 +mem/0: location 1027 is 1076 +mem/0: storing 108 in location 1076 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1023 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1023 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1022 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1023 is 3 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/22 +mem/0: location 1024 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1023 is 3 +run/0: address to copy is 1004 +run/0: its type is 4 +mem/0: location 1004 is 108 +run/0: product 0 is 108 +mem/0: storing 108 in location 1025 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1025 is 108 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/25 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 3 +run/0: address to copy is 1077 +run/0: product 0 is 1077 +mem/0: storing 1077 in location 1027 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1025 is 108 +mem/0: location 1027 is 1077 +mem/0: storing 108 in location 1077 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1023 is 3 +run/0: ingredient 1 is 1 +run/0: product 0 is 4 +mem/0: storing 4 in location 1023 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 3 +run/0: ingredient 1 is 1 +run/0: product 0 is 4 +mem/0: storing 4 in location 1022 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1023 is 4 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/22 +mem/0: location 1024 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1023 is 4 +run/0: address to copy is 1005 +run/0: its type is 4 +mem/0: location 1005 is 111 +run/0: product 0 is 111 +mem/0: storing 111 in location 1025 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1025 is 111 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/25 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 4 +run/0: address to copy is 1078 +run/0: product 0 is 1078 +mem/0: storing 1078 in location 1027 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1025 is 111 +mem/0: location 1027 is 1078 +mem/0: storing 111 in location 1078 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1023 is 4 +run/0: ingredient 1 is 1 +run/0: product 0 is 5 +mem/0: storing 5 in location 1023 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 4 +run/0: ingredient 1 is 1 +run/0: product 0 is 5 +mem/0: storing 5 in location 1022 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1023 is 5 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/22 +mem/0: location 1024 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1023 is 5 +run/0: address to copy is 1006 +run/0: its type is 4 +mem/0: location 1006 is 44 +run/0: product 0 is 44 +mem/0: storing 44 in location 1025 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1025 is 44 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/25 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 5 +run/0: address to copy is 1079 +run/0: product 0 is 1079 +mem/0: storing 1079 in location 1027 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1025 is 44 +mem/0: location 1027 is 1079 +mem/0: storing 44 in location 1079 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1023 is 5 +run/0: ingredient 1 is 1 +run/0: product 0 is 6 +mem/0: storing 6 in location 1023 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 5 +run/0: ingredient 1 is 1 +run/0: product 0 is 6 +mem/0: storing 6 in location 1022 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1023 is 6 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/22 +mem/0: location 1024 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1023 is 6 +run/0: address to copy is 1007 +run/0: its type is 4 +mem/0: location 1007 is 32 +run/0: product 0 is 32 +mem/0: storing 32 in location 1025 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1025 is 32 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/25 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 6 +run/0: address to copy is 1080 +run/0: product 0 is 1080 +mem/0: storing 1080 in location 1027 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1025 is 32 +mem/0: location 1027 is 1080 +mem/0: storing 32 in location 1080 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1023 is 6 +run/0: ingredient 1 is 1 +run/0: product 0 is 7 +mem/0: storing 7 in location 1023 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 6 +run/0: ingredient 1 is 1 +run/0: product 0 is 7 +mem/0: storing 7 in location 1022 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1023 is 7 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/22 +mem/0: location 1024 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1023 is 7 +run/0: address to copy is 1008 +run/0: its type is 4 +mem/0: location 1008 is 95 +run/0: product 0 is 95 +mem/0: storing 95 in location 1025 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1025 is 95 +run/0: ingredient 1 is 95 +run/0: product 0 is 1 +mem/0: storing 1 in location 1026 +run/0: instruction interpolate/25 +mem/0: location 1026 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 31 +run/0: instruction interpolate/32 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1028 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1028 is 0 +run/0: ingredient 1 is a-len +mem/0: location 1020 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1029 +run/0: instruction interpolate/35 +mem/0: location 1029 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1018 is 1009 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1028 is 0 +run/0: address to copy is 1010 +run/0: its type is 4 +mem/0: location 1010 is 97 +run/0: product 0 is 97 +mem/0: storing 97 in location 1025 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 7 +run/0: address to copy is 1081 +run/0: product 0 is 1081 +mem/0: storing 1081 in location 1027 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1025 is 97 +mem/0: location 1027 is 1081 +mem/0: storing 97 in location 1081 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1028 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1028 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 7 +run/0: ingredient 1 is 1 +run/0: product 0 is 8 +mem/0: storing 8 in location 1022 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1028 is 1 +run/0: ingredient 1 is a-len +mem/0: location 1020 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1029 +run/0: instruction interpolate/35 +mem/0: location 1029 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1018 is 1009 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1028 is 1 +run/0: address to copy is 1011 +run/0: its type is 4 +mem/0: location 1011 is 98 +run/0: product 0 is 98 +mem/0: storing 98 in location 1025 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 8 +run/0: address to copy is 1082 +run/0: product 0 is 1082 +mem/0: storing 1082 in location 1027 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1025 is 98 +mem/0: location 1027 is 1082 +mem/0: storing 98 in location 1082 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1028 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1028 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 8 +run/0: ingredient 1 is 1 +run/0: product 0 is 9 +mem/0: storing 9 in location 1022 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1028 is 2 +run/0: ingredient 1 is a-len +mem/0: location 1020 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1029 +run/0: instruction interpolate/35 +mem/0: location 1029 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1018 is 1009 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1028 is 2 +run/0: address to copy is 1012 +run/0: its type is 4 +mem/0: location 1012 is 99 +run/0: product 0 is 99 +mem/0: storing 99 in location 1025 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1021 is 1073 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1022 is 9 +run/0: address to copy is 1083 +run/0: product 0 is 1083 +mem/0: storing 1083 in location 1027 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1025 is 99 +mem/0: location 1027 is 1083 +mem/0: storing 99 in location 1083 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1028 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1028 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1022 is 9 +run/0: ingredient 1 is 1 +run/0: product 0 is 10 +mem/0: storing 10 in location 1022 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1028 is 3 +run/0: ingredient 1 is a-len +mem/0: location 1020 is 3 +run/0: product 0 is 1 +mem/0: storing 1 in location 1029 +run/0: instruction interpolate/35 +mem/0: location 1029 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 42 +run/0: instruction interpolate/43 +run/0: ingredient 0 is i +mem/0: location 1023 is 7 +run/0: ingredient 1 is 1 +run/0: product 0 is 8 +mem/0: storing 8 in location 1023 +run/0: instruction interpolate/44 +run/0: ingredient 0 is -27 +run/0: pc now 17 +run/0: instruction interpolate/18 +mem/0: storing 0 in location 1019 +run/0: instruction interpolate/19 +mem/0: location 1019 is 0 +run/0: ingredient 0 is 0 +run/0: ingredient 1 is +run/0: jumping to instruction 45 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1023 is 8 +run/0: ingredient 1 is tem-len +mem/0: location 1016 is 8 +run/0: product 0 is 1 +mem/0: storing 1 in location 1024 +run/0: instruction interpolate/48 +mem/0: location 1024 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 55 +run/0: instruction interpolate/56 +mem/0: location 1021 is 1073 +run/0: result 0 is 1073 +mem/0: storing 1073 in location 3 +run/0: instruction test-interpolate-at-end/3 +run/0: ingredient 0 is 3 +mem/0: location 3 is 1073 +mem/0: location 1073 is 10 +mem/0: location 1074 is 104 +mem/0: location 1075 is 101 +mem/0: location 1076 is 108 +mem/0: location 1077 is 108 +mem/0: location 1078 is 111 +mem/0: location 1079 is 44 +mem/0: location 1080 is 32 +mem/0: location 1081 is 97 +mem/0: location 1082 is 98 +mem/0: location 1083 is 99 +mem/0: storing 10 in location 4 +mem/0: storing 104 in location 5 +mem/0: storing 101 in location 6 +mem/0: storing 108 in location 7 +mem/0: storing 108 in location 8 +mem/0: storing 111 in location 9 +mem/0: storing 44 in location 10 +mem/0: storing 32 in location 11 +mem/0: storing 97 in location 12 +mem/0: storing 98 in location 13 +mem/0: storing 99 in location 14 diff --git a/cpp/.traces/interpolate-at-start b/cpp/.traces/interpolate-at-start new file mode 100644 index 00000000..23c1d877 --- /dev/null +++ b/cpp/.traces/interpolate-at-start @@ -0,0 +1,741 @@ +parse/0: instruction: 35 +parse/0: ingredient: {name: "_, hello!", value: 0, type: 0, properties: ["_, hello!": "literal-string"]} +parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} +parse/0: instruction: 35 +parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} +parse/0: product: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} +parse/0: instruction: 107 +parse/0: ingredient: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} +parse/0: ingredient: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} +parse/0: product: {name: "3", value: 0, type: 2-5-4, properties: ["3": "address":"array":"character", "raw": ]} +parse/0: instruction: 1 +parse/0: ingredient: {name: "3", value: 0, type: 2-5-4, properties: ["3": "address":"array":"character", "raw": , "deref": ]} +parse/0: product: {name: "4", value: 0, type: 5-4, properties: ["4": "array":"character", "raw": ]} +new/0: _, hello! -> 0 +new/0: abc -> 0 +after-brace/0: recipe test-interpolate-at-start +after-brace/0: new ... +after-brace/0: new ... +after-brace/0: interpolate ... +after-brace/0: copy ... +run/0: instruction test-interpolate-at-start/0 +mem/0: storing 1000 in location 1 +run/0: instruction test-interpolate-at-start/1 +mem/0: storing 1010 in location 2 +run/0: instruction test-interpolate-at-start/2 +mem/0: location 1 is 1000 +mem/0: location 2 is 1010 +run/0: instruction interpolate/0 +mem/0: new alloc: 1014 +mem/0: array size is 60 +run/0: instruction interpolate/1 +run/0: product 0 is 1000 +mem/0: storing 1000 in location 1016 +run/0: instruction interpolate/2 +mem/0: location 1016 is 1000 +mem/0: storing 9 in location 1017 +run/0: instruction interpolate/3 +run/0: ingredient 0 is tem-len +mem/0: location 1017 is 9 +mem/0: storing 9 in location 1018 +run/0: instruction interpolate/5 +run/0: product 0 is 1010 +mem/0: storing 1010 in location 1019 +mem/0: storing 1 in location 1020 +run/0: instruction interpolate/6 +mem/0: location 1020 is 1 +run/0: ingredient 0 is 1 +run/0: jump-unless fell through +run/0: instruction interpolate/7 +mem/0: location 1019 is 1010 +mem/0: storing 3 in location 1021 +run/0: instruction interpolate/8 +run/0: ingredient 0 is result-len +mem/0: location 1018 is 9 +run/0: ingredient 1 is a-len +mem/0: location 1021 is 3 +run/0: product 0 is 12 +mem/0: storing 12 in location 1018 +run/0: instruction interpolate/9 +run/0: ingredient 0 is result-len +mem/0: location 1018 is 12 +run/0: ingredient 1 is 1 +run/0: product 0 is 11 +mem/0: storing 11 in location 1018 +run/0: instruction interpolate/10 +run/0: ingredient 0 is -6 +run/0: pc now 4 +run/0: instruction interpolate/5 +mem/0: storing 0 in location 1020 +run/0: instruction interpolate/6 +mem/0: location 1020 is 0 +run/0: ingredient 0 is 0 +run/0: ingredient 1 is +run/0: jumping to instruction 11 +run/0: instruction interpolate/12 +run/0: instruction interpolate/13 +run/0: product 0 is 1000 +run/0: instruction interpolate/14 +mem/0: new alloc: 1074 +mem/0: storing 1074 in location 1022 +mem/0: location 1018 is 11 +mem/0: array size is 11 +run/0: instruction interpolate/15 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1023 +run/0: instruction interpolate/16 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1024 +run/0: instruction interpolate/18 +run/0: product 0 is 1010 +mem/0: storing 1010 in location 1019 +mem/0: storing 1 in location 1020 +run/0: instruction interpolate/19 +mem/0: location 1020 is 1 +run/0: ingredient 0 is 1 +run/0: jump-unless fell through +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1024 is 0 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/22 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 0 +run/0: address to copy is 1001 +run/0: its type is 4 +mem/0: location 1001 is 95 +run/0: product 0 is 95 +mem/0: storing 95 in location 1026 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1026 is 95 +run/0: ingredient 1 is 95 +run/0: product 0 is 1 +mem/0: storing 1 in location 1027 +run/0: instruction interpolate/25 +mem/0: location 1027 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 31 +run/0: instruction interpolate/32 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1029 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1029 is 0 +run/0: ingredient 1 is a-len +mem/0: location 1021 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1030 +run/0: instruction interpolate/35 +mem/0: location 1030 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1019 is 1010 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1029 is 0 +run/0: address to copy is 1011 +run/0: its type is 4 +mem/0: location 1011 is 97 +run/0: product 0 is 97 +mem/0: storing 97 in location 1026 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 0 +run/0: address to copy is 1075 +run/0: product 0 is 1075 +mem/0: storing 1075 in location 1028 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1026 is 97 +mem/0: location 1028 is 1075 +mem/0: storing 97 in location 1075 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1029 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1029 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1023 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1029 is 1 +run/0: ingredient 1 is a-len +mem/0: location 1021 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1030 +run/0: instruction interpolate/35 +mem/0: location 1030 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1019 is 1010 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1029 is 1 +run/0: address to copy is 1012 +run/0: its type is 4 +mem/0: location 1012 is 98 +run/0: product 0 is 98 +mem/0: storing 98 in location 1026 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 1 +run/0: address to copy is 1076 +run/0: product 0 is 1076 +mem/0: storing 1076 in location 1028 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1026 is 98 +mem/0: location 1028 is 1076 +mem/0: storing 98 in location 1076 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1029 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1029 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1023 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1029 is 2 +run/0: ingredient 1 is a-len +mem/0: location 1021 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1030 +run/0: instruction interpolate/35 +mem/0: location 1030 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1019 is 1010 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1029 is 2 +run/0: address to copy is 1013 +run/0: its type is 4 +mem/0: location 1013 is 99 +run/0: product 0 is 99 +mem/0: storing 99 in location 1026 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 2 +run/0: address to copy is 1077 +run/0: product 0 is 1077 +mem/0: storing 1077 in location 1028 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1026 is 99 +mem/0: location 1028 is 1077 +mem/0: storing 99 in location 1077 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1029 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1029 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1023 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1029 is 3 +run/0: ingredient 1 is a-len +mem/0: location 1021 is 3 +run/0: product 0 is 1 +mem/0: storing 1 in location 1030 +run/0: instruction interpolate/35 +mem/0: location 1030 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 42 +run/0: instruction interpolate/43 +run/0: ingredient 0 is i +mem/0: location 1024 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1024 +run/0: instruction interpolate/44 +run/0: ingredient 0 is -27 +run/0: pc now 17 +run/0: instruction interpolate/18 +mem/0: storing 0 in location 1020 +run/0: instruction interpolate/19 +mem/0: location 1020 is 0 +run/0: ingredient 0 is 0 +run/0: ingredient 1 is +run/0: jumping to instruction 45 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 1 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/49 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 1 +run/0: address to copy is 1002 +run/0: its type is 4 +mem/0: location 1002 is 44 +run/0: product 0 is 44 +mem/0: storing 44 in location 1026 +run/0: instruction interpolate/50 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 3 +run/0: address to copy is 1078 +run/0: product 0 is 1078 +mem/0: storing 1078 in location 1028 +run/0: instruction interpolate/51 +run/0: ingredient 0 is in +mem/0: location 1026 is 44 +mem/0: location 1028 is 1078 +mem/0: storing 44 in location 1078 +run/0: instruction interpolate/52 +run/0: ingredient 0 is i +mem/0: location 1024 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1024 +run/0: instruction interpolate/53 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 3 +run/0: ingredient 1 is 1 +run/0: product 0 is 4 +mem/0: storing 4 in location 1023 +run/0: instruction interpolate/54 +run/0: ingredient 0 is -8 +run/0: pc now 46 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 2 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/49 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 2 +run/0: address to copy is 1003 +run/0: its type is 4 +mem/0: location 1003 is 32 +run/0: product 0 is 32 +mem/0: storing 32 in location 1026 +run/0: instruction interpolate/50 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 4 +run/0: address to copy is 1079 +run/0: product 0 is 1079 +mem/0: storing 1079 in location 1028 +run/0: instruction interpolate/51 +run/0: ingredient 0 is in +mem/0: location 1026 is 32 +mem/0: location 1028 is 1079 +mem/0: storing 32 in location 1079 +run/0: instruction interpolate/52 +run/0: ingredient 0 is i +mem/0: location 1024 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1024 +run/0: instruction interpolate/53 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 4 +run/0: ingredient 1 is 1 +run/0: product 0 is 5 +mem/0: storing 5 in location 1023 +run/0: instruction interpolate/54 +run/0: ingredient 0 is -8 +run/0: pc now 46 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 3 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/49 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 3 +run/0: address to copy is 1004 +run/0: its type is 4 +mem/0: location 1004 is 104 +run/0: product 0 is 104 +mem/0: storing 104 in location 1026 +run/0: instruction interpolate/50 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 5 +run/0: address to copy is 1080 +run/0: product 0 is 1080 +mem/0: storing 1080 in location 1028 +run/0: instruction interpolate/51 +run/0: ingredient 0 is in +mem/0: location 1026 is 104 +mem/0: location 1028 is 1080 +mem/0: storing 104 in location 1080 +run/0: instruction interpolate/52 +run/0: ingredient 0 is i +mem/0: location 1024 is 3 +run/0: ingredient 1 is 1 +run/0: product 0 is 4 +mem/0: storing 4 in location 1024 +run/0: instruction interpolate/53 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 5 +run/0: ingredient 1 is 1 +run/0: product 0 is 6 +mem/0: storing 6 in location 1023 +run/0: instruction interpolate/54 +run/0: ingredient 0 is -8 +run/0: pc now 46 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 4 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/49 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 4 +run/0: address to copy is 1005 +run/0: its type is 4 +mem/0: location 1005 is 101 +run/0: product 0 is 101 +mem/0: storing 101 in location 1026 +run/0: instruction interpolate/50 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 6 +run/0: address to copy is 1081 +run/0: product 0 is 1081 +mem/0: storing 1081 in location 1028 +run/0: instruction interpolate/51 +run/0: ingredient 0 is in +mem/0: location 1026 is 101 +mem/0: location 1028 is 1081 +mem/0: storing 101 in location 1081 +run/0: instruction interpolate/52 +run/0: ingredient 0 is i +mem/0: location 1024 is 4 +run/0: ingredient 1 is 1 +run/0: product 0 is 5 +mem/0: storing 5 in location 1024 +run/0: instruction interpolate/53 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 6 +run/0: ingredient 1 is 1 +run/0: product 0 is 7 +mem/0: storing 7 in location 1023 +run/0: instruction interpolate/54 +run/0: ingredient 0 is -8 +run/0: pc now 46 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 5 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/49 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 5 +run/0: address to copy is 1006 +run/0: its type is 4 +mem/0: location 1006 is 108 +run/0: product 0 is 108 +mem/0: storing 108 in location 1026 +run/0: instruction interpolate/50 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 7 +run/0: address to copy is 1082 +run/0: product 0 is 1082 +mem/0: storing 1082 in location 1028 +run/0: instruction interpolate/51 +run/0: ingredient 0 is in +mem/0: location 1026 is 108 +mem/0: location 1028 is 1082 +mem/0: storing 108 in location 1082 +run/0: instruction interpolate/52 +run/0: ingredient 0 is i +mem/0: location 1024 is 5 +run/0: ingredient 1 is 1 +run/0: product 0 is 6 +mem/0: storing 6 in location 1024 +run/0: instruction interpolate/53 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 7 +run/0: ingredient 1 is 1 +run/0: product 0 is 8 +mem/0: storing 8 in location 1023 +run/0: instruction interpolate/54 +run/0: ingredient 0 is -8 +run/0: pc now 46 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 6 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/49 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 6 +run/0: address to copy is 1007 +run/0: its type is 4 +mem/0: location 1007 is 108 +run/0: product 0 is 108 +mem/0: storing 108 in location 1026 +run/0: instruction interpolate/50 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 8 +run/0: address to copy is 1083 +run/0: product 0 is 1083 +mem/0: storing 1083 in location 1028 +run/0: instruction interpolate/51 +run/0: ingredient 0 is in +mem/0: location 1026 is 108 +mem/0: location 1028 is 1083 +mem/0: storing 108 in location 1083 +run/0: instruction interpolate/52 +run/0: ingredient 0 is i +mem/0: location 1024 is 6 +run/0: ingredient 1 is 1 +run/0: product 0 is 7 +mem/0: storing 7 in location 1024 +run/0: instruction interpolate/53 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 8 +run/0: ingredient 1 is 1 +run/0: product 0 is 9 +mem/0: storing 9 in location 1023 +run/0: instruction interpolate/54 +run/0: ingredient 0 is -8 +run/0: pc now 46 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 7 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/49 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 7 +run/0: address to copy is 1008 +run/0: its type is 4 +mem/0: location 1008 is 111 +run/0: product 0 is 111 +mem/0: storing 111 in location 1026 +run/0: instruction interpolate/50 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 9 +run/0: address to copy is 1084 +run/0: product 0 is 1084 +mem/0: storing 1084 in location 1028 +run/0: instruction interpolate/51 +run/0: ingredient 0 is in +mem/0: location 1026 is 111 +mem/0: location 1028 is 1084 +mem/0: storing 111 in location 1084 +run/0: instruction interpolate/52 +run/0: ingredient 0 is i +mem/0: location 1024 is 7 +run/0: ingredient 1 is 1 +run/0: product 0 is 8 +mem/0: storing 8 in location 1024 +run/0: instruction interpolate/53 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 9 +run/0: ingredient 1 is 1 +run/0: product 0 is 10 +mem/0: storing 10 in location 1023 +run/0: instruction interpolate/54 +run/0: ingredient 0 is -8 +run/0: pc now 46 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 8 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/49 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1016 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1024 is 8 +run/0: address to copy is 1009 +run/0: its type is 4 +mem/0: location 1009 is 33 +run/0: product 0 is 33 +mem/0: storing 33 in location 1026 +run/0: instruction interpolate/50 +run/0: ingredient 0 is result +mem/0: location 1022 is 1074 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1023 is 10 +run/0: address to copy is 1085 +run/0: product 0 is 1085 +mem/0: storing 1085 in location 1028 +run/0: instruction interpolate/51 +run/0: ingredient 0 is in +mem/0: location 1026 is 33 +mem/0: location 1028 is 1085 +mem/0: storing 33 in location 1085 +run/0: instruction interpolate/52 +run/0: ingredient 0 is i +mem/0: location 1024 is 8 +run/0: ingredient 1 is 1 +run/0: product 0 is 9 +mem/0: storing 9 in location 1024 +run/0: instruction interpolate/53 +run/0: ingredient 0 is result-idx +mem/0: location 1023 is 10 +run/0: ingredient 1 is 1 +run/0: product 0 is 11 +mem/0: storing 11 in location 1023 +run/0: instruction interpolate/54 +run/0: ingredient 0 is -8 +run/0: pc now 46 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1024 is 9 +run/0: ingredient 1 is tem-len +mem/0: location 1017 is 9 +run/0: product 0 is 1 +mem/0: storing 1 in location 1025 +run/0: instruction interpolate/48 +mem/0: location 1025 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 55 +run/0: instruction interpolate/56 +mem/0: location 1022 is 1074 +run/0: result 0 is 1074 +mem/0: storing 1074 in location 3 +run/0: instruction test-interpolate-at-start/3 +run/0: ingredient 0 is 3 +mem/0: location 3 is 1074 +mem/0: location 1074 is 11 +mem/0: location 1075 is 97 +mem/0: location 1076 is 98 +mem/0: location 1077 is 99 +mem/0: location 1078 is 44 +mem/0: location 1079 is 32 +mem/0: location 1080 is 104 +mem/0: location 1081 is 101 +mem/0: location 1082 is 108 +mem/0: location 1083 is 108 +mem/0: location 1084 is 111 +mem/0: location 1085 is 33 +mem/0: storing 11 in location 4 +mem/0: storing 97 in location 5 +mem/0: storing 98 in location 6 +mem/0: storing 99 in location 7 +mem/0: storing 44 in location 8 +mem/0: storing 32 in location 9 +mem/0: storing 104 in location 10 +mem/0: storing 101 in location 11 +mem/0: storing 108 in location 12 +mem/0: storing 108 in location 13 +mem/0: storing 111 in location 14 +mem/0: storing 33 in location 15 diff --git a/cpp/.traces/interpolate-works b/cpp/.traces/interpolate-works new file mode 100644 index 00000000..c61cd12a --- /dev/null +++ b/cpp/.traces/interpolate-works @@ -0,0 +1,577 @@ +parse/0: instruction: 35 +parse/0: ingredient: {name: "abc _", value: 0, type: 0, properties: ["abc _": "literal-string"]} +parse/0: product: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} +parse/0: instruction: 35 +parse/0: ingredient: {name: "def", value: 0, type: 0, properties: ["def": "literal-string"]} +parse/0: product: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} +parse/0: instruction: 107 +parse/0: ingredient: {name: "1", value: 0, type: 2-5-4, properties: ["1": "address":"array":"character", "raw": ]} +parse/0: ingredient: {name: "2", value: 0, type: 2-5-4, properties: ["2": "address":"array":"character", "raw": ]} +parse/0: product: {name: "3", value: 0, type: 2-5-4, properties: ["3": "address":"array":"character", "raw": ]} +parse/0: instruction: 1 +parse/0: ingredient: {name: "3", value: 0, type: 2-5-4, properties: ["3": "address":"array":"character", "raw": , "deref": ]} +parse/0: product: {name: "4", value: 0, type: 5-4, properties: ["4": "array":"character", "raw": ]} +new/0: abc _ -> 0 +new/0: def -> 0 +after-brace/0: recipe test-interpolate-works +after-brace/0: new ... +after-brace/0: new ... +after-brace/0: interpolate ... +after-brace/0: copy ... +run/0: instruction test-interpolate-works/0 +mem/0: storing 1000 in location 1 +run/0: instruction test-interpolate-works/1 +mem/0: storing 1006 in location 2 +run/0: instruction test-interpolate-works/2 +mem/0: location 1 is 1000 +mem/0: location 2 is 1006 +run/0: instruction interpolate/0 +mem/0: new alloc: 1010 +mem/0: array size is 60 +run/0: instruction interpolate/1 +run/0: product 0 is 1000 +mem/0: storing 1000 in location 1012 +run/0: instruction interpolate/2 +mem/0: location 1012 is 1000 +mem/0: storing 5 in location 1013 +run/0: instruction interpolate/3 +run/0: ingredient 0 is tem-len +mem/0: location 1013 is 5 +mem/0: storing 5 in location 1014 +run/0: instruction interpolate/5 +run/0: product 0 is 1006 +mem/0: storing 1006 in location 1015 +mem/0: storing 1 in location 1016 +run/0: instruction interpolate/6 +mem/0: location 1016 is 1 +run/0: ingredient 0 is 1 +run/0: jump-unless fell through +run/0: instruction interpolate/7 +mem/0: location 1015 is 1006 +mem/0: storing 3 in location 1017 +run/0: instruction interpolate/8 +run/0: ingredient 0 is result-len +mem/0: location 1014 is 5 +run/0: ingredient 1 is a-len +mem/0: location 1017 is 3 +run/0: product 0 is 8 +mem/0: storing 8 in location 1014 +run/0: instruction interpolate/9 +run/0: ingredient 0 is result-len +mem/0: location 1014 is 8 +run/0: ingredient 1 is 1 +run/0: product 0 is 7 +mem/0: storing 7 in location 1014 +run/0: instruction interpolate/10 +run/0: ingredient 0 is -6 +run/0: pc now 4 +run/0: instruction interpolate/5 +mem/0: storing 0 in location 1016 +run/0: instruction interpolate/6 +mem/0: location 1016 is 0 +run/0: ingredient 0 is 0 +run/0: ingredient 1 is +run/0: jumping to instruction 11 +run/0: instruction interpolate/12 +run/0: instruction interpolate/13 +run/0: product 0 is 1000 +run/0: instruction interpolate/14 +mem/0: new alloc: 1070 +mem/0: storing 1070 in location 1018 +mem/0: location 1014 is 7 +mem/0: array size is 7 +run/0: instruction interpolate/15 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1019 +run/0: instruction interpolate/16 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1020 +run/0: instruction interpolate/18 +run/0: product 0 is 1006 +mem/0: storing 1006 in location 1015 +mem/0: storing 1 in location 1016 +run/0: instruction interpolate/19 +mem/0: location 1016 is 1 +run/0: ingredient 0 is 1 +run/0: jump-unless fell through +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1020 is 0 +run/0: ingredient 1 is tem-len +mem/0: location 1013 is 5 +run/0: product 0 is 0 +mem/0: storing 0 in location 1021 +run/0: instruction interpolate/22 +mem/0: location 1021 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1012 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1020 is 0 +run/0: address to copy is 1001 +run/0: its type is 4 +mem/0: location 1001 is 97 +run/0: product 0 is 97 +mem/0: storing 97 in location 1022 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1022 is 97 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1023 +run/0: instruction interpolate/25 +mem/0: location 1023 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1018 is 1070 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1019 is 0 +run/0: address to copy is 1071 +run/0: product 0 is 1071 +mem/0: storing 1071 in location 1024 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1022 is 97 +mem/0: location 1024 is 1071 +mem/0: storing 97 in location 1071 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1020 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1020 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1019 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1019 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1020 is 1 +run/0: ingredient 1 is tem-len +mem/0: location 1013 is 5 +run/0: product 0 is 0 +mem/0: storing 0 in location 1021 +run/0: instruction interpolate/22 +mem/0: location 1021 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1012 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1020 is 1 +run/0: address to copy is 1002 +run/0: its type is 4 +mem/0: location 1002 is 98 +run/0: product 0 is 98 +mem/0: storing 98 in location 1022 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1022 is 98 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1023 +run/0: instruction interpolate/25 +mem/0: location 1023 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1018 is 1070 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1019 is 1 +run/0: address to copy is 1072 +run/0: product 0 is 1072 +mem/0: storing 1072 in location 1024 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1022 is 98 +mem/0: location 1024 is 1072 +mem/0: storing 98 in location 1072 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1020 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1020 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1019 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1019 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1020 is 2 +run/0: ingredient 1 is tem-len +mem/0: location 1013 is 5 +run/0: product 0 is 0 +mem/0: storing 0 in location 1021 +run/0: instruction interpolate/22 +mem/0: location 1021 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1012 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1020 is 2 +run/0: address to copy is 1003 +run/0: its type is 4 +mem/0: location 1003 is 99 +run/0: product 0 is 99 +mem/0: storing 99 in location 1022 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1022 is 99 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1023 +run/0: instruction interpolate/25 +mem/0: location 1023 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1018 is 1070 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1019 is 2 +run/0: address to copy is 1073 +run/0: product 0 is 1073 +mem/0: storing 1073 in location 1024 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1022 is 99 +mem/0: location 1024 is 1073 +mem/0: storing 99 in location 1073 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1020 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1020 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1019 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1019 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1020 is 3 +run/0: ingredient 1 is tem-len +mem/0: location 1013 is 5 +run/0: product 0 is 0 +mem/0: storing 0 in location 1021 +run/0: instruction interpolate/22 +mem/0: location 1021 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1012 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1020 is 3 +run/0: address to copy is 1004 +run/0: its type is 4 +mem/0: location 1004 is 32 +run/0: product 0 is 32 +mem/0: storing 32 in location 1022 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1022 is 32 +run/0: ingredient 1 is 95 +run/0: product 0 is 0 +mem/0: storing 0 in location 1023 +run/0: instruction interpolate/25 +mem/0: location 1023 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/26 +run/0: ingredient 0 is result +mem/0: location 1018 is 1070 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1019 is 3 +run/0: address to copy is 1074 +run/0: product 0 is 1074 +mem/0: storing 1074 in location 1024 +run/0: instruction interpolate/27 +run/0: ingredient 0 is in +mem/0: location 1022 is 32 +mem/0: location 1024 is 1074 +mem/0: storing 32 in location 1074 +run/0: instruction interpolate/28 +run/0: ingredient 0 is i +mem/0: location 1020 is 3 +run/0: ingredient 1 is 1 +run/0: product 0 is 4 +mem/0: storing 4 in location 1020 +run/0: instruction interpolate/29 +run/0: ingredient 0 is result-idx +mem/0: location 1019 is 3 +run/0: ingredient 1 is 1 +run/0: product 0 is 4 +mem/0: storing 4 in location 1019 +run/0: instruction interpolate/30 +run/0: ingredient 0 is -10 +run/0: pc now 20 +run/0: instruction interpolate/21 +run/0: ingredient 0 is i +mem/0: location 1020 is 4 +run/0: ingredient 1 is tem-len +mem/0: location 1013 is 5 +run/0: product 0 is 0 +mem/0: storing 0 in location 1021 +run/0: instruction interpolate/22 +mem/0: location 1021 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/23 +run/0: ingredient 0 is {name: "template", value: 1, type: 2-5-4, properties: ["template": "address":"array":"character", "deref": ]} +mem/0: location 1012 is 1000 +run/0: ingredient 1 is {name: "i", value: 9, type: 1, properties: ["i": "integer"]} +mem/0: location 1020 is 4 +run/0: address to copy is 1005 +run/0: its type is 4 +mem/0: location 1005 is 95 +run/0: product 0 is 95 +mem/0: storing 95 in location 1022 +run/0: instruction interpolate/24 +run/0: ingredient 0 is in +mem/0: location 1022 is 95 +run/0: ingredient 1 is 95 +run/0: product 0 is 1 +mem/0: storing 1 in location 1023 +run/0: instruction interpolate/25 +mem/0: location 1023 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 31 +run/0: instruction interpolate/32 +run/0: ingredient 0 is 0 +mem/0: storing 0 in location 1025 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1025 is 0 +run/0: ingredient 1 is a-len +mem/0: location 1017 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/35 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1006 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1025 is 0 +run/0: address to copy is 1007 +run/0: its type is 4 +mem/0: location 1007 is 100 +run/0: product 0 is 100 +mem/0: storing 100 in location 1022 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1018 is 1070 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1019 is 4 +run/0: address to copy is 1075 +run/0: product 0 is 1075 +mem/0: storing 1075 in location 1024 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1022 is 100 +mem/0: location 1024 is 1075 +mem/0: storing 100 in location 1075 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1025 is 0 +run/0: ingredient 1 is 1 +run/0: product 0 is 1 +mem/0: storing 1 in location 1025 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1019 is 4 +run/0: ingredient 1 is 1 +run/0: product 0 is 5 +mem/0: storing 5 in location 1019 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1025 is 1 +run/0: ingredient 1 is a-len +mem/0: location 1017 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/35 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1006 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1025 is 1 +run/0: address to copy is 1008 +run/0: its type is 4 +mem/0: location 1008 is 101 +run/0: product 0 is 101 +mem/0: storing 101 in location 1022 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1018 is 1070 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1019 is 5 +run/0: address to copy is 1076 +run/0: product 0 is 1076 +mem/0: storing 1076 in location 1024 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1022 is 101 +mem/0: location 1024 is 1076 +mem/0: storing 101 in location 1076 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1025 is 1 +run/0: ingredient 1 is 1 +run/0: product 0 is 2 +mem/0: storing 2 in location 1025 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1019 is 5 +run/0: ingredient 1 is 1 +run/0: product 0 is 6 +mem/0: storing 6 in location 1019 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1025 is 2 +run/0: ingredient 1 is a-len +mem/0: location 1017 is 3 +run/0: product 0 is 0 +mem/0: storing 0 in location 1026 +run/0: instruction interpolate/35 +mem/0: location 1026 is 0 +run/0: ingredient 0 is 0 +run/0: jump-if fell through +run/0: instruction interpolate/36 +run/0: ingredient 0 is {name: "a", value: 4, type: 2-5-4, properties: ["a": "address":"array":"character", "deref": ]} +mem/0: location 1015 is 1006 +run/0: ingredient 1 is {name: "j", value: 14, type: 1, properties: ["j": "integer"]} +mem/0: location 1025 is 2 +run/0: address to copy is 1009 +run/0: its type is 4 +mem/0: location 1009 is 102 +run/0: product 0 is 102 +mem/0: storing 102 in location 1022 +run/0: instruction interpolate/37 +run/0: ingredient 0 is result +mem/0: location 1018 is 1070 +run/0: ingredient 1 is {name: "result-idx", value: 8, type: 1, properties: ["result-idx": "integer"]} +mem/0: location 1019 is 6 +run/0: address to copy is 1077 +run/0: product 0 is 1077 +mem/0: storing 1077 in location 1024 +run/0: instruction interpolate/38 +run/0: ingredient 0 is in +mem/0: location 1022 is 102 +mem/0: location 1024 is 1077 +mem/0: storing 102 in location 1077 +run/0: instruction interpolate/39 +run/0: ingredient 0 is j +mem/0: location 1025 is 2 +run/0: ingredient 1 is 1 +run/0: product 0 is 3 +mem/0: storing 3 in location 1025 +run/0: instruction interpolate/40 +run/0: ingredient 0 is result-idx +mem/0: location 1019 is 6 +run/0: ingredient 1 is 1 +run/0: product 0 is 7 +mem/0: storing 7 in location 1019 +run/0: instruction interpolate/41 +run/0: ingredient 0 is -8 +run/0: pc now 33 +run/0: instruction interpolate/34 +run/0: ingredient 0 is j +mem/0: location 1025 is 3 +run/0: ingredient 1 is a-len +mem/0: location 1017 is 3 +run/0: product 0 is 1 +mem/0: storing 1 in location 1026 +run/0: instruction interpolate/35 +mem/0: location 1026 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 42 +run/0: instruction interpolate/43 +run/0: ingredient 0 is i +mem/0: location 1020 is 4 +run/0: ingredient 1 is 1 +run/0: product 0 is 5 +mem/0: storing 5 in location 1020 +run/0: instruction interpolate/44 +run/0: ingredient 0 is -27 +run/0: pc now 17 +run/0: instruction interpolate/18 +mem/0: storing 0 in location 1016 +run/0: instruction interpolate/19 +mem/0: location 1016 is 0 +run/0: ingredient 0 is 0 +run/0: ingredient 1 is +run/0: jumping to instruction 45 +run/0: instruction interpolate/47 +run/0: ingredient 0 is i +mem/0: location 1020 is 5 +run/0: ingredient 1 is tem-len +mem/0: location 1013 is 5 +run/0: product 0 is 1 +mem/0: storing 1 in location 1021 +run/0: instruction interpolate/48 +mem/0: location 1021 is 1 +run/0: ingredient 0 is 1 +run/0: ingredient 1 is +run/0: jumping to instruction 55 +run/0: instruction interpolate/56 +mem/0: location 1018 is 1070 +run/0: result 0 is 1070 +mem/0: storing 1070 in location 3 +run/0: instruction test-interpolate-works/3 +run/0: ingredient 0 is 3 +mem/0: location 3 is 1070 +mem/0: location 1070 is 7 +mem/0: location 1071 is 97 +mem/0: location 1072 is 98 +mem/0: location 1073 is 99 +mem/0: location 1074 is 32 +mem/0: location 1075 is 100 +mem/0: location 1076 is 101 +mem/0: location 1077 is 102 +mem/0: storing 7 in location 4 +mem/0: storing 97 in location 5 +mem/0: storing 98 in location 6 +mem/0: storing 99 in location 7 +mem/0: storing 32 in location 8 +mem/0: storing 100 in location 9 +mem/0: storing 101 in location 10 +mem/0: storing 102 in location 11 diff --git a/cpp/060string.mu b/cpp/060string.mu index e76d25c8..a92d4637 100644 --- a/cpp/060string.mu +++ b/cpp/060string.mu @@ -393,3 +393,160 @@ scenario string-append-1 [ 17 <- 33 # '!' ] ] + +# replace underscores in first with remaining args +# result:address:array:character <- interpolate template:address:array:character, ... +recipe interpolate [ + default-space:array:address:location <- new location:type, 60:literal + template:address:array:character <- next-ingredient + # compute result-len, space to allocate for result + tem-len:integer <- length template:address:array:character/deref + result-len:integer <- copy tem-len:integer + { + # while arg received + a:address:array:character, arg-received?:boolean <- next-ingredient + break-unless arg-received?:boolean + # result-len = result-len + arg.length - 1 for the 'underscore' being replaced + a-len:integer <- length a:address:array:character/deref + result-len:integer <- add result-len:integer, a-len:integer + result-len:integer <- subtract result-len:integer, 1:literal + loop + } +#? $print tem-len:integer #? 1 +#? $print [ ] #? 1 +#? $print result-len:integer #? 1 +#? $print [ #? 1 +#? ] #? 1 + rewind-ingredients + _ <- next-ingredient # skip template + # result = new array:character[result-len] + result:address:array:character <- new character:type, result-len:integer + # repeatedly copy sections of template and 'holes' into result + result-idx:integer <- copy 0:literal + i:integer <- copy 0:literal + { + # while arg received + a:address:array:character, arg-received?:boolean <- next-ingredient + break-unless arg-received?:boolean + # copy template into result until '_' + { + # while i < template.length + tem-done?:boolean <- greater-or-equal i:integer, tem-len:integer + break-if tem-done?:boolean, 2:blocks + # while template[i] != '_' + in:character <- index template:address:array:character/deref, i:integer + underscore?:boolean <- equal in:character, 95:literal # '_' + break-if underscore?:boolean + # result[result-idx] = template[i] + out:address:character <- index-address result:address:array:character/deref, result-idx:integer + out:address:character/deref <- copy in:character + # ++i + i:integer <- add i:integer, 1:literal + # ++result-idx + result-idx:integer <- add result-idx:integer, 1:literal + loop + } + # copy 'a' into result + j:integer <- copy 0:literal + { + # while j < a.length + arg-done?:boolean <- greater-or-equal j:integer, a-len:integer + break-if arg-done?:boolean + # result[result-idx] = a[j] + in:character <- index a:address:array:character/deref, j:integer + out:address:character <- index-address result:address:array:character/deref, result-idx:integer + out:address:character/deref <- copy in:character + # ++j + j:integer <- add j:integer, 1:literal + # ++result-idx + result-idx:integer <- add result-idx:integer, 1:literal + loop + } + # skip '_' in template + i:integer <- add i:integer, 1:literal + loop # interpolate next arg + } + # done with holes; copy rest of template directly into result + { + # while i < template.length + tem-done?:boolean <- greater-or-equal i:integer, tem-len:integer + break-if tem-done?:boolean + # result[result-idx] = template[i] + in:character <- index template:address:array:character/deref, i:integer + out:address:character <- index-address result:address:array:character/deref, result-idx:integer + out:address:character/deref <- copy in:character + # ++i + i:integer <- add i:integer, 1:literal + # ++result-idx + result-idx:integer <- add result-idx:integer, 1:literal + loop + } + reply result:address:array:character +] + +scenario interpolate-works [ +#? dump run #? 1 + run [ + 1:address:array:character/raw <- new [abc _] + 2:address:array:character/raw <- new [def] + 3:address:array:character/raw <- interpolate 1:address:array:character/raw, 2:address:array:character/raw + 4:array:character/raw <- copy 3:address:array:character/raw/deref + ] + memory should contain [ + 4 <- 7 # length + 5 <- 97 # 'a' + 6 <- 98 # 'b' + 7 <- 99 # 'c' + 8 <- 32 # ' ' + 9 <- 100 # 'd' + 10 <- 101 # 'e' + 11 <- 102 # 'f' + ] +] + +scenario interpolate-at-start [ + run [ + 1:address:array:character/raw <- new [_, hello!] + 2:address:array:character/raw <- new [abc] + 3:address:array:character/raw <- interpolate 1:address:array:character/raw, 2:address:array:character/raw + 4:array:character/raw <- copy 3:address:array:character/raw/deref + ] + memory should contain [ + 4 <- 11 # length + 5 <- 97 # 'a' + 6 <- 98 # 'b' + 7 <- 99 # 'c' + 8 <- 44 # ',' + 9 <- 32 # ' ' + 10 <- 104 # 'h' + 11 <- 101 # 'e' + 12 <- 108 # 'l' + 13 <- 108 # 'l' + 14 <- 111 # 'o' + 15 <- 33 # '!' + 16 <- 0 # out of bounds + ] +] + +scenario interpolate-at-end [ + run [ + 1:address:array:character/raw <- new [hello, _] + 2:address:array:character/raw <- new [abc] + 3:address:array:character/raw <- interpolate 1:address:array:character/raw, 2:address:array:character/raw + 4:array:character/raw <- copy 3:address:array:character/raw/deref + ] + memory should contain [ + 4 <- 10 # length + 5 <- 104 # 'h' + 6 <- 101 # 'e' + 7 <- 108 # 'l' + 8 <- 108 # 'l' + 9 <- 111 # 'o' + 10 <- 44 # ',' + 11 <- 32 # ' ' + 12 <- 97 # 'a' + 13 <- 98 # 'b' + 14 <- 99 # 'c' + 15 <- 0 # out of bounds + ] +] |