From 353a452e691a8b55e28d7b3b1d09cf294265eba0 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 17 Apr 2015 10:33:26 -0700 Subject: 1074 --- cpp/.traces/array_length | 2 +- cpp/.traces/brace_conversion | 2 +- cpp/.traces/break_cascading | 4 +-- cpp/.traces/break_cascading2 | 4 +-- cpp/.traces/break_empty_block | 2 +- cpp/.traces/break_if | 4 +-- cpp/.traces/break_label | 2 +- cpp/.traces/break_nested | 2 +- cpp/.traces/break_nested_degenerate | 2 +- cpp/.traces/break_nested_degenerate2 | 2 +- cpp/.traces/break_unless | 2 +- cpp/.traces/closure | 12 ++++----- cpp/.traces/factorial | 4 +-- cpp/.traces/loop | 2 +- cpp/.traces/loop_nested | 2 +- cpp/.traces/loop_unless | 2 +- cpp/.traces/new | 4 +-- cpp/.traces/new_array | 4 +-- cpp/.traces/new_string | 2 +- cpp/.traces/next_ingredient | 2 +- cpp/.traces/reply | 4 +-- cpp/.traces/reply_container | 4 +-- .../string-equal-common-lengths-but-distinct | 6 ++--- cpp/.traces/string-equal-distinct-lengths | 6 ++--- cpp/.traces/string-equal-identical | 6 ++--- cpp/.traces/string-equal-reflexive | 4 +-- cpp/.traces/string-equal-with-empty | 6 ++--- cpp/.traces/string_literal | 2 +- cpp/.traces/string_literal_nested | 2 +- cpp/.traces/string_literal_with_colons | 2 +- cpp/023length | 30 ++++++++++++++++++++++ cpp/036length | 30 ---------------------- 32 files changed, 82 insertions(+), 82 deletions(-) create mode 100644 cpp/023length delete mode 100644 cpp/036length diff --git a/cpp/.traces/array_length b/cpp/.traces/array_length index 50c80830..65ae6484 100644 --- a/cpp/.traces/array_length +++ b/cpp/.traces/array_length @@ -10,7 +10,7 @@ parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "16", value: 0, type: 0, properties: ["16": "literal"]} parse/0: product: {name: "4", value: 0, type: 1, properties: ["4": "integer"]} -parse/0: instruction: 31 +parse/0: instruction: 22 parse/0: ingredient: {name: "1", value: 0, type: 5-1, properties: ["1": "array":"integer"]} parse/0: product: {name: "5", value: 0, type: 1, properties: ["5": "integer"]} after-brace/0: recipe main diff --git a/cpp/.traces/brace_conversion b/cpp/.traces/brace_conversion index 5c203a41..c9444a7c 100644 --- a/cpp/.traces/brace_conversion +++ b/cpp/.traces/brace_conversion @@ -1,5 +1,5 @@ parse/0: label: { -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} diff --git a/cpp/.traces/break_cascading b/cpp/.traces/break_cascading index b7ed6d16..06127e3d 100644 --- a/cpp/.traces/break_cascading +++ b/cpp/.traces/break_cascading @@ -2,10 +2,10 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: label: { -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: label: } parse/0: label: { -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: label: } brace/0: 1000: push (open, 1) brace/0: push (close, 3) diff --git a/cpp/.traces/break_cascading2 b/cpp/.traces/break_cascading2 index 3154e219..2cd8aea6 100644 --- a/cpp/.traces/break_cascading2 +++ b/cpp/.traces/break_cascading2 @@ -5,13 +5,13 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: label: { -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} parse/0: label: } parse/0: label: { -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: label: } brace/0: 1000: push (open, 2) brace/0: push (close, 5) diff --git a/cpp/.traces/break_empty_block b/cpp/.traces/break_empty_block index 75d85845..3605ac83 100644 --- a/cpp/.traces/break_empty_block +++ b/cpp/.traces/break_empty_block @@ -2,7 +2,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: label: { -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: label: } brace/0: 1000: push (open, 1) brace/0: push (close, 3) diff --git a/cpp/.traces/break_if b/cpp/.traces/break_if index 4b9f1654..d5f5d0e9 100644 --- a/cpp/.traces/break_if +++ b/cpp/.traces/break_if @@ -5,14 +5,14 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: label: { -parse/0: instruction: 25 +parse/0: instruction: 26 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} parse/0: label: } parse/0: label: { -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: label: } brace/0: 1000: push (open, 2) brace/0: push (close, 5) diff --git a/cpp/.traces/break_label b/cpp/.traces/break_label index bc2c89b5..fe03e6c2 100644 --- a/cpp/.traces/break_label +++ b/cpp/.traces/break_label @@ -2,7 +2,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: label: { -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: ingredient: {name: "+foo", value: 0, type: 0, properties: ["+foo": "offset"]} parse/0: label: } brace/0: 1000: push (open, 1) diff --git a/cpp/.traces/break_nested b/cpp/.traces/break_nested index 5513254e..ac8c5a30 100644 --- a/cpp/.traces/break_nested +++ b/cpp/.traces/break_nested @@ -5,7 +5,7 @@ parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} diff --git a/cpp/.traces/break_nested_degenerate b/cpp/.traces/break_nested_degenerate index 30ce0e3e..c2c5d1a2 100644 --- a/cpp/.traces/break_nested_degenerate +++ b/cpp/.traces/break_nested_degenerate @@ -5,7 +5,7 @@ parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: label: { parse/0: label: } parse/0: instruction: 1 diff --git a/cpp/.traces/break_nested_degenerate2 b/cpp/.traces/break_nested_degenerate2 index c071c872..dcbe62ad 100644 --- a/cpp/.traces/break_nested_degenerate2 +++ b/cpp/.traces/break_nested_degenerate2 @@ -5,7 +5,7 @@ parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} -parse/0: instruction: 24 +parse/0: instruction: 25 parse/0: label: { parse/0: label: } parse/0: label: } diff --git a/cpp/.traces/break_unless b/cpp/.traces/break_unless index 8a2cde50..03fd8a90 100644 --- a/cpp/.traces/break_unless +++ b/cpp/.traces/break_unless @@ -5,7 +5,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: label: { -parse/0: instruction: 26 +parse/0: instruction: 27 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} diff --git a/cpp/.traces/closure b/cpp/.traces/closure index 152df47e..f5a41ee9 100644 --- a/cpp/.traces/closure +++ b/cpp/.traces/closure @@ -1,4 +1,4 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} @@ -10,7 +10,7 @@ parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer", parse/0: instruction: 1002 parse/0: ingredient: {name: "1", value: 0, type: 2-0, properties: ["1": "address":"space", "names": "init-counter"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer", "raw": ]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} @@ -20,13 +20,13 @@ parse/0: product: {name: "x", value: 0, type: 1, properties: ["x": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "3", value: 0, type: 0, properties: ["3": "literal"]} parse/0: product: {name: "y", value: 0, type: 1, properties: ["y": "integer"]} -parse/0: instruction: 23 +parse/0: instruction: 24 parse/0: ingredient: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "space", value: 0, type: 0, properties: ["space": "literal"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} -parse/0: instruction: 22 +parse/0: instruction: 23 parse/0: product: {name: "0", value: 0, type: 2-0, properties: ["0": "address":"space", "names": "init-counter"]} parse/0: instruction: 2 parse/0: ingredient: {name: "y", value: 0, type: 1, properties: ["y": "integer", "space": "1"]} @@ -35,7 +35,7 @@ parse/0: product: {name: "y", value: 0, type: 1, properties: ["y": "integer", parse/0: instruction: 1 parse/0: ingredient: {name: "234", value: 0, type: 0, properties: ["234": "literal"]} parse/0: product: {name: "y", value: 0, type: 1, properties: ["y": "integer"]} -parse/0: instruction: 23 +parse/0: instruction: 24 parse/0: ingredient: {name: "y", value: 0, type: 1, properties: ["y": "integer", "space": "1"]} name/0: recipe increment-counter is surrounded by init-counter new/0: location -> 1 diff --git a/cpp/.traces/factorial b/cpp/.traces/factorial index 6cd0a307..9a7f261e 100644 --- a/cpp/.traces/factorial +++ b/cpp/.traces/factorial @@ -9,7 +9,7 @@ parse/0: instruction: 13 parse/0: ingredient: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: ingredient: {name: "1", value: 0, type: 0, properties: ["1": "literal"]} parse/0: product: {name: "3", value: 0, type: 3, properties: ["3": "boolean"]} -parse/0: instruction: 25 +parse/0: instruction: 26 parse/0: ingredient: {name: "3", value: 0, type: 3, properties: ["3": "boolean"]} parse/0: instruction: 4 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} @@ -19,7 +19,7 @@ parse/0: instruction: 3 parse/0: ingredient: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} parse/0: ingredient: {name: "1", value: 0, type: 0, properties: ["1": "literal"]} parse/0: product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]} -parse/0: instruction: 27 +parse/0: instruction: 28 parse/0: label: } parse/0: instruction: 1 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} diff --git a/cpp/.traces/loop b/cpp/.traces/loop index 0d8a1496..cf494543 100644 --- a/cpp/.traces/loop +++ b/cpp/.traces/loop @@ -8,7 +8,7 @@ parse/0: label: { parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} -parse/0: instruction: 27 +parse/0: instruction: 28 parse/0: label: } brace/0: 1000: push (open, 2) brace/0: push (close, 5) diff --git a/cpp/.traces/loop_nested b/cpp/.traces/loop_nested index 09ba9c37..d6d78346 100644 --- a/cpp/.traces/loop_nested +++ b/cpp/.traces/loop_nested @@ -10,7 +10,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} parse/0: label: } -parse/0: instruction: 28 +parse/0: instruction: 29 parse/0: ingredient: {name: "4", value: 0, type: 3, properties: ["4": "boolean"]} parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} diff --git a/cpp/.traces/loop_unless b/cpp/.traces/loop_unless index c8e6e8d7..9d5f5892 100644 --- a/cpp/.traces/loop_unless +++ b/cpp/.traces/loop_unless @@ -5,7 +5,7 @@ parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} parse/0: product: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: label: { -parse/0: instruction: 29 +parse/0: instruction: 30 parse/0: ingredient: {name: "2", value: 0, type: 1, properties: ["2": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]} diff --git a/cpp/.traces/new b/cpp/.traces/new index 4c3d8001..5e148caf 100644 --- a/cpp/.traces/new +++ b/cpp/.traces/new @@ -1,7 +1,7 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "integer", value: 0, type: 0, properties: ["integer": "type"]} parse/0: product: {name: "1", value: 0, type: 2-1, properties: ["1": "address":"integer", "raw": ]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "integer", value: 0, type: 0, properties: ["integer": "type"]} parse/0: product: {name: "2", value: 0, type: 2-1, properties: ["2": "address":"integer", "raw": ]} parse/0: instruction: 13 diff --git a/cpp/.traces/new_array b/cpp/.traces/new_array index d2e846bb..a480b46d 100644 --- a/cpp/.traces/new_array +++ b/cpp/.traces/new_array @@ -1,8 +1,8 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "integer", value: 0, type: 0, properties: ["integer": "type"]} parse/0: ingredient: {name: "5", value: 0, type: 0, properties: ["5": "literal"]} parse/0: product: {name: "1", value: 0, type: 2-5-1, properties: ["1": "address":"array":"integer", "raw": ]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "integer", value: 0, type: 0, properties: ["integer": "type"]} parse/0: product: {name: "2", value: 0, type: 2-1, properties: ["2": "address":"integer", "raw": ]} parse/0: instruction: 3 diff --git a/cpp/.traces/new_string b/cpp/.traces/new_string index 96077d14..fe4fe3e8 100644 --- a/cpp/.traces/new_string +++ b/cpp/.traces/new_string @@ -1,4 +1,4 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc def", value: 0, type: 0, properties: ["abc def": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-8, properties: ["1": "address":"array":"character"]} parse/0: instruction: 20 diff --git a/cpp/.traces/next_ingredient b/cpp/.traces/next_ingredient index d515b829..a296bd69 100644 --- a/cpp/.traces/next_ingredient +++ b/cpp/.traces/next_ingredient @@ -1,6 +1,6 @@ parse/0: instruction: 1001 parse/0: ingredient: {name: "2", value: 0, type: 0, properties: ["2": "literal"]} -parse/0: instruction: 22 +parse/0: instruction: 23 parse/0: product: {name: "12", value: 0, type: 1, properties: ["12": "integer"]} parse/0: instruction: 2 parse/0: ingredient: {name: "1", value: 0, type: 0, properties: ["1": "literal"]} diff --git a/cpp/.traces/reply b/cpp/.traces/reply index b2553ebc..1dde3540 100644 --- a/cpp/.traces/reply +++ b/cpp/.traces/reply @@ -2,13 +2,13 @@ parse/0: instruction: 1001 parse/0: ingredient: {name: "2", value: 0, type: 0, properties: ["2": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} parse/0: product: {name: "4", value: 0, type: 1, properties: ["4": "integer"]} -parse/0: instruction: 22 +parse/0: instruction: 23 parse/0: product: {name: "12", value: 0, type: 1, properties: ["12": "integer"]} parse/0: instruction: 2 parse/0: ingredient: {name: "1", value: 0, type: 0, properties: ["1": "literal"]} parse/0: ingredient: {name: "12", value: 0, type: 1, properties: ["12": "integer"]} parse/0: product: {name: "13", value: 0, type: 1, properties: ["13": "integer"]} -parse/0: instruction: 23 +parse/0: instruction: 24 parse/0: ingredient: {name: "12", value: 0, type: 1, properties: ["12": "integer"]} parse/0: ingredient: {name: "13", value: 0, type: 1, properties: ["13": "integer"]} after-brace/0: recipe f diff --git a/cpp/.traces/reply_container b/cpp/.traces/reply_container index 1a3541e6..1b491677 100644 --- a/cpp/.traces/reply_container +++ b/cpp/.traces/reply_container @@ -1,12 +1,12 @@ parse/0: instruction: 1001 parse/0: ingredient: {name: "2", value: 0, type: 0, properties: ["2": "literal"]} parse/0: product: {name: "3", value: 0, type: 6, properties: ["3": "point"]} -parse/0: instruction: 22 +parse/0: instruction: 23 parse/0: product: {name: "12", value: 0, type: 1, properties: ["12": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "35", value: 0, type: 0, properties: ["35": "literal"]} parse/0: product: {name: "13", value: 0, type: 1, properties: ["13": "integer"]} -parse/0: instruction: 23 +parse/0: instruction: 24 parse/0: ingredient: {name: "12", value: 0, type: 6, properties: ["12": "point"]} after-brace/0: recipe f after-brace/0: next-ingredient ... diff --git a/cpp/.traces/string-equal-common-lengths-but-distinct b/cpp/.traces/string-equal-common-lengths-but-distinct index e5e99282..22b9eed7 100644 --- a/cpp/.traces/string-equal-common-lengths-but-distinct +++ b/cpp/.traces/string-equal-common-lengths-but-distinct @@ -1,11 +1,11 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-8, properties: ["x": "address":"array":"character"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abd", value: 0, type: 0, properties: ["abd": "literal-string"]} parse/0: product: {name: "y", value: 0, type: 2-5-8, properties: ["y": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string-equal-distinct-lengths b/cpp/.traces/string-equal-distinct-lengths index 4af8113c..0c69eb1a 100644 --- a/cpp/.traces/string-equal-distinct-lengths +++ b/cpp/.traces/string-equal-distinct-lengths @@ -1,11 +1,11 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-8, properties: ["x": "address":"array":"character"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abcd", value: 0, type: 0, properties: ["abcd": "literal-string"]} parse/0: product: {name: "y", value: 0, type: 2-5-8, properties: ["y": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string-equal-identical b/cpp/.traces/string-equal-identical index 7d25443e..164582af 100644 --- a/cpp/.traces/string-equal-identical +++ b/cpp/.traces/string-equal-identical @@ -1,11 +1,11 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-8, properties: ["x": "address":"array":"character"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "y", value: 0, type: 2-5-8, properties: ["y": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string-equal-reflexive b/cpp/.traces/string-equal-reflexive index ab94aa39..2a629bbb 100644 --- a/cpp/.traces/string-equal-reflexive +++ b/cpp/.traces/string-equal-reflexive @@ -1,8 +1,8 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc", value: 0, type: 0, properties: ["abc": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-8, properties: ["x": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string-equal-with-empty b/cpp/.traces/string-equal-with-empty index 22a9d4a9..803e017b 100644 --- a/cpp/.traces/string-equal-with-empty +++ b/cpp/.traces/string-equal-with-empty @@ -1,11 +1,11 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "location", value: 0, type: 0, properties: ["location": "type"]} parse/0: ingredient: {name: "30", value: 0, type: 0, properties: ["30": "literal"]} parse/0: product: {name: "default-space", value: 0, type: 2-0, properties: ["default-space": "address":"space"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "", value: 0, type: 0, properties: ["": "literal-string"]} parse/0: product: {name: "x", value: 0, type: 2-5-8, properties: ["x": "address":"array":"character"]} -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abcd", value: 0, type: 0, properties: ["abcd": "literal-string"]} parse/0: product: {name: "y", value: 0, type: 2-5-8, properties: ["y": "address":"array":"character"]} parse/0: instruction: 100 diff --git a/cpp/.traces/string_literal b/cpp/.traces/string_literal index 80393a55..0562305b 100644 --- a/cpp/.traces/string_literal +++ b/cpp/.traces/string_literal @@ -1,4 +1,4 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc def", value: 0, type: 0, properties: ["abc def": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-8, properties: ["1": "address":"array":"character"]} new/0: abc def -> 0 diff --git a/cpp/.traces/string_literal_nested b/cpp/.traces/string_literal_nested index 923cd140..d91739ec 100644 --- a/cpp/.traces/string_literal_nested +++ b/cpp/.traces/string_literal_nested @@ -1,4 +1,4 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc [def]", value: 0, type: 0, properties: ["abc [def]": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-8, properties: ["1": "address":"array":"character"]} new/0: abc [def] -> 0 diff --git a/cpp/.traces/string_literal_with_colons b/cpp/.traces/string_literal_with_colons index c00ab66a..cf30be82 100644 --- a/cpp/.traces/string_literal_with_colons +++ b/cpp/.traces/string_literal_with_colons @@ -1,4 +1,4 @@ -parse/0: instruction: 30 +parse/0: instruction: 31 parse/0: ingredient: {name: "abc:def/ghi", value: 0, type: 0, properties: ["abc:def/ghi": "literal-string"]} parse/0: product: {name: "1", value: 0, type: 2-5-8, properties: ["1": "address":"array":"character"]} new/0: abc:def/ghi -> 0 diff --git a/cpp/023length b/cpp/023length new file mode 100644 index 00000000..9d3bb714 --- /dev/null +++ b/cpp/023length @@ -0,0 +1,30 @@ +//: Recipe to compute the length of an array. + +:(scenario "array_length") +recipe main [ + 1:integer <- copy 3:literal + 2:integer <- copy 14:literal + 3:integer <- copy 15:literal + 4:integer <- copy 16:literal + 5:integer <- length 1:array:integer +] ++run: instruction main/4 ++mem: storing 3 in location 5 + +:(before "End Primitive Recipe Declarations") +LENGTH, +:(before "End Primitive Recipe Numbers") +Recipe_number["length"] = LENGTH; +:(before "End Primitive Recipe Implementations") +case LENGTH: { + reagent x = canonize(instructions[pc].ingredients[0]); + if (x.types[0] != Type_number["array"]) { + raise << "tried to calculate length of non-array " << x.to_string() << '\n'; + break; + } + vector result; +//? cout << "length: " << x.value << '\n'; //? 1 + result.push_back(Memory[x.value]); + write_memory(instructions[pc].products[0], result); + break; +} diff --git a/cpp/036length b/cpp/036length deleted file mode 100644 index 9d3bb714..00000000 --- a/cpp/036length +++ /dev/null @@ -1,30 +0,0 @@ -//: Recipe to compute the length of an array. - -:(scenario "array_length") -recipe main [ - 1:integer <- copy 3:literal - 2:integer <- copy 14:literal - 3:integer <- copy 15:literal - 4:integer <- copy 16:literal - 5:integer <- length 1:array:integer -] -+run: instruction main/4 -+mem: storing 3 in location 5 - -:(before "End Primitive Recipe Declarations") -LENGTH, -:(before "End Primitive Recipe Numbers") -Recipe_number["length"] = LENGTH; -:(before "End Primitive Recipe Implementations") -case LENGTH: { - reagent x = canonize(instructions[pc].ingredients[0]); - if (x.types[0] != Type_number["array"]) { - raise << "tried to calculate length of non-array " << x.to_string() << '\n'; - break; - } - vector result; -//? cout << "length: " << x.value << '\n'; //? 1 - result.push_back(Memory[x.value]); - write_memory(instructions[pc].products[0], result); - break; -} -- cgit 1.4.1-2-gfad0