diff options
-rw-r--r-- | 016dilated_reagent.cc (renamed from 053dilated_reagent.cc) | 1 | ||||
-rw-r--r-- | 017parse_tree.cc (renamed from 054parse_tree.cc) | 30 | ||||
-rw-r--r-- | 034address.cc | 15 | ||||
-rw-r--r-- | 035lookup.cc | 11 | ||||
-rw-r--r-- | 048scenario.cc (renamed from 050scenario.cc) | 0 | ||||
-rw-r--r-- | 049scenario_test.mu (renamed from 051scenario_test.mu) | 0 | ||||
-rw-r--r-- | 050tangle.cc (renamed from 052tangle.cc) | 0 | ||||
-rw-r--r-- | 051recipe_header.cc (renamed from 055recipe_header.cc) | 0 | ||||
-rw-r--r-- | 052static_dispatch.cc (renamed from 056static_dispatch.cc) | 0 | ||||
-rw-r--r-- | 053shape_shifting_container.cc (renamed from 057shape_shifting_container.cc) | 0 | ||||
-rw-r--r-- | 054shape_shifting_recipe.cc (renamed from 058shape_shifting_recipe.cc) | 0 | ||||
-rw-r--r-- | 060recipe.cc (renamed from 061recipe.cc) | 0 | ||||
-rw-r--r-- | 061scheduler.cc (renamed from 062scheduler.cc) | 0 | ||||
-rw-r--r-- | 062wait.cc (renamed from 063wait.cc) | 0 | ||||
-rw-r--r-- | 063rewrite_literal_string.cc (renamed from 064rewrite_literal_string.cc) | 0 |
15 files changed, 25 insertions, 32 deletions
diff --git a/053dilated_reagent.cc b/016dilated_reagent.cc index 868c98f5..fa5c3ba2 100644 --- a/053dilated_reagent.cc +++ b/016dilated_reagent.cc @@ -16,7 +16,6 @@ def main [ ] # successfully parsed -:(scenarios run) :(scenario dilated_reagent_with_comment) def main [ {1: number, foo: bar} <- copy 34 # test comment diff --git a/054parse_tree.cc b/017parse_tree.cc index b5082e58..833fb978 100644 --- a/054parse_tree.cc +++ b/017parse_tree.cc @@ -3,6 +3,7 @@ // come in handy later for expressing complex types, like "a dictionary from // (address to array of charaters) to (list of numbers)". +:(scenarios load) :(scenario dilated_reagent_with_nested_brackets) def main [ {1: number, foo: (bar (baz quux))} <- copy 34 @@ -68,32 +69,3 @@ container foo [ container bar [ ] +parse: product: {1: ("foo" ("address" "array" "character") ("bar" "number"))} - -:(scenario dilated_reagent_in_static_array) -def main [ - {1: (array (address number) 3)} <- create-array - 5:address:number <- new number:type - {1: (array (address number) 3)} <- put-index {1: (array (address number) 3)}, 0, 5:address:number - *5:address:number <- copy 34 - 6:number <- copy *5:address:number -] -+run: creating array of size 4 -+mem: storing 34 in location 6 - -//: an exception is 'new', which takes a type tree as its ingredient *value* - -:(scenario dilated_reagent_with_new) -def main [ - x:address:address:number <- new {(address number): type} -] -+new: size of ("address" "number") is 1 - -:(before "End Post-processing(expected_product) When Checking 'new'") -{ - string_tree* tmp_type_names = parse_string_tree(expected_product.type->name); - delete expected_product.type; - expected_product.type = new_type_tree(tmp_type_names); - delete tmp_type_names; -} -:(before "End Post-processing(type_name) When Converting 'new'") -type_name = parse_string_tree(type_name); diff --git a/034address.cc b/034address.cc index 8966d9bf..e699a14d 100644 --- a/034address.cc +++ b/034address.cc @@ -132,6 +132,12 @@ def main [ ] +mem: storing 0 in location 3 +:(scenario dilated_reagent_with_new) +def main [ + 1:address:address:number <- new {(address number): type} +] ++new: size of ("address" "number") is 1 + //: 'new' takes a weird 'type' as its first ingredient; don't error on it :(before "End Mu Types Initialization") put(Type_ordinal, "type", 0); @@ -180,7 +186,12 @@ bool product_of_new_is_valid(const instruction& inst) { drop_from_type(product, "array"); } reagent/*copy*/ expected_product("x:"+inst.ingredients.at(0).name); - // End Post-processing(expected_product) When Checking 'new' + { + string_tree* tmp_type_names = parse_string_tree(expected_product.type->name); + delete expected_product.type; + expected_product.type = new_type_tree(tmp_type_names); + delete tmp_type_names; + } return types_strictly_match(product, expected_product); } @@ -224,7 +235,7 @@ void transform_new_to_allocate(const recipe_ordinal r) { if (inst.name == "new") { inst.operation = ALLOCATE; string_tree* type_name = new string_tree(inst.ingredients.at(0).name); - // End Post-processing(type_name) When Converting 'new' + type_name = parse_string_tree(type_name); type_tree* type = new_type_tree(type_name); inst.ingredients.at(0).set_value(size_of(type)); trace(9992, "new") << "size of " << to_string(type_name) << " is " << inst.ingredients.at(0).value << end(); diff --git a/035lookup.cc b/035lookup.cc index 98490d29..6aa7d2a2 100644 --- a/035lookup.cc +++ b/035lookup.cc @@ -319,6 +319,17 @@ def main [ ] +mem: storing 34 in location 3 +:(scenario dilated_reagent_in_static_array) +def main [ + {1: (array (address number) 3)} <- create-array + 5:address:number <- new number:type + {1: (array (address number) 3)} <- put-index {1: (array (address number) 3)}, 0, 5:address:number + *5:address:number <- copy 34 + 6:number <- copy *5:address:number +] ++run: creating array of size 4 ++mem: storing 34 in location 6 + :(before "Update PUT_INDEX base in Check") if (!canonize_type(base)) break; :(before "Update PUT_INDEX index in Check") diff --git a/050scenario.cc b/048scenario.cc index 4a455187..4a455187 100644 --- a/050scenario.cc +++ b/048scenario.cc diff --git a/051scenario_test.mu b/049scenario_test.mu index 4f86c188..4f86c188 100644 --- a/051scenario_test.mu +++ b/049scenario_test.mu diff --git a/052tangle.cc b/050tangle.cc index ea11f58f..ea11f58f 100644 --- a/052tangle.cc +++ b/050tangle.cc diff --git a/055recipe_header.cc b/051recipe_header.cc index 29787fae..29787fae 100644 --- a/055recipe_header.cc +++ b/051recipe_header.cc diff --git a/056static_dispatch.cc b/052static_dispatch.cc index 5271fe13..5271fe13 100644 --- a/056static_dispatch.cc +++ b/052static_dispatch.cc diff --git a/057shape_shifting_container.cc b/053shape_shifting_container.cc index fb847899..fb847899 100644 --- a/057shape_shifting_container.cc +++ b/053shape_shifting_container.cc diff --git a/058shape_shifting_recipe.cc b/054shape_shifting_recipe.cc index c69678bf..c69678bf 100644 --- a/058shape_shifting_recipe.cc +++ b/054shape_shifting_recipe.cc diff --git a/061recipe.cc b/060recipe.cc index 93fe1bd2..93fe1bd2 100644 --- a/061recipe.cc +++ b/060recipe.cc diff --git a/062scheduler.cc b/061scheduler.cc index a3d0baad..a3d0baad 100644 --- a/062scheduler.cc +++ b/061scheduler.cc diff --git a/063wait.cc b/062wait.cc index e07d658a..e07d658a 100644 --- a/063wait.cc +++ b/062wait.cc diff --git a/064rewrite_literal_string.cc b/063rewrite_literal_string.cc index 9eeeefaa..9eeeefaa 100644 --- a/064rewrite_literal_string.cc +++ b/063rewrite_literal_string.cc |