diff options
-rw-r--r-- | cpp/.traces/calling_recipe | 4 | ||||
-rw-r--r-- | cpp/.traces/closure | 12 | ||||
-rw-r--r-- | cpp/.traces/ingredient | 4 | ||||
-rw-r--r-- | cpp/.traces/next_ingredient | 4 | ||||
-rw-r--r-- | cpp/.traces/next_ingredient_missing | 4 | ||||
-rw-r--r-- | cpp/.traces/reply | 4 | ||||
-rw-r--r-- | cpp/.traces/reply_container | 4 | ||||
-rw-r--r-- | cpp/.traces/return_on_fallthrough | 6 | ||||
-rw-r--r-- | cpp/.traces/rewind_ingredients | 4 | ||||
-rw-r--r-- | cpp/003trace | 11 | ||||
-rw-r--r-- | cpp/010vm | 10 | ||||
-rw-r--r-- | cpp/012transform | 4 | ||||
-rw-r--r-- | cpp/041name | 6 | ||||
-rw-r--r-- | cpp/054closure_name | 10 |
14 files changed, 41 insertions, 46 deletions
diff --git a/cpp/.traces/calling_recipe b/cpp/.traces/calling_recipe index cb35c59d..763acb53 100644 --- a/cpp/.traces/calling_recipe +++ b/cpp/.traces/calling_recipe @@ -3,10 +3,10 @@ parse/0: instruction: 2 parse/0: ingredient: {name: "2", value: 0, type: 0, properties: ["2": "literal"]} parse/0: ingredient: {name: "2", value: 0, type: 0, properties: ["2": "literal"]} parse/0: product: {name: "3", value: 0, type: 1, properties: ["3": "integer"]} -after-brace/0: recipe f -after-brace/0: add ... after-brace/0: recipe main after-brace/0: f ... +after-brace/0: recipe f +after-brace/0: add ... run/0: instruction main/0 run/0: instruction f/0 run/0: ingredient 0 is 2 diff --git a/cpp/.traces/closure b/cpp/.traces/closure index 73ba0a6e..f8bd5a9a 100644 --- a/cpp/.traces/closure +++ b/cpp/.traces/closure @@ -39,11 +39,16 @@ parse/0: instruction: 28 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 +new/0: location -> 1 name/0: assign x 1 name/0: assign y 2 new/0: space -> 0 name/0: assign y 1 -new/0: location -> 1 +after-brace/0: recipe main +after-brace/0: new ... +after-brace/0: init-counter ... +after-brace/0: increment-counter ... +after-brace/0: increment-counter ... after-brace/0: recipe init-counter after-brace/0: new ... after-brace/0: copy ... @@ -55,11 +60,6 @@ after-brace/0: next-ingredient ... after-brace/0: add ... after-brace/0: copy ... after-brace/0: reply ... -after-brace/0: recipe main -after-brace/0: new ... -after-brace/0: init-counter ... -after-brace/0: increment-counter ... -after-brace/0: increment-counter ... run/0: instruction main/0 mem/0: new alloc: 1000 mem/0: array size is 30 diff --git a/cpp/.traces/ingredient b/cpp/.traces/ingredient index 4b028b84..0d8fbf96 100644 --- a/cpp/.traces/ingredient +++ b/cpp/.traces/ingredient @@ -7,11 +7,11 @@ parse/0: product: {name: "12", value: 0, type: 1, properties: ["12": "integer" parse/0: instruction: 25 parse/0: product: {name: "13", value: 0, type: 1, properties: ["13": "integer"]} parse/0: product: {name: "1", value: 0, type: 3, properties: ["1": "boolean"]} +after-brace/0: recipe main +after-brace/0: f ... after-brace/0: recipe f after-brace/0: ingredient ... after-brace/0: next-ingredient ... -after-brace/0: recipe main -after-brace/0: f ... run/0: instruction main/0 run/0: instruction f/0 run/0: product 0 is 2 diff --git a/cpp/.traces/next_ingredient b/cpp/.traces/next_ingredient index c9ce76a0..0d6c4bb8 100644 --- a/cpp/.traces/next_ingredient +++ b/cpp/.traces/next_ingredient @@ -6,11 +6,11 @@ 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"]} +after-brace/0: recipe main +after-brace/0: f ... after-brace/0: recipe f after-brace/0: next-ingredient ... after-brace/0: add ... -after-brace/0: recipe main -after-brace/0: f ... run/0: instruction main/0 run/0: instruction f/0 run/0: product 0 is 2 diff --git a/cpp/.traces/next_ingredient_missing b/cpp/.traces/next_ingredient_missing index 07d681ca..385f047b 100644 --- a/cpp/.traces/next_ingredient_missing +++ b/cpp/.traces/next_ingredient_missing @@ -2,10 +2,10 @@ parse/0: instruction: 1001 parse/0: instruction: 25 parse/0: product: {name: "_", value: 0, type: 0, properties: ["_": "dummy"]} parse/0: product: {name: "12", value: 0, type: 1, properties: ["12": "integer"]} -after-brace/0: recipe f -after-brace/0: next-ingredient ... after-brace/0: recipe main after-brace/0: f ... +after-brace/0: recipe f +after-brace/0: next-ingredient ... run/0: instruction main/0 run/0: instruction f/0 mem/0: storing 0 in location 12 diff --git a/cpp/.traces/reply b/cpp/.traces/reply index a58a1193..566299b7 100644 --- a/cpp/.traces/reply +++ b/cpp/.traces/reply @@ -11,12 +11,12 @@ parse/0: product: {name: "13", value: 0, type: 1, properties: ["13": "integer" parse/0: instruction: 28 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 main +after-brace/0: f ... after-brace/0: recipe f after-brace/0: next-ingredient ... after-brace/0: add ... after-brace/0: reply ... -after-brace/0: recipe main -after-brace/0: f ... run/0: instruction main/0 run/0: instruction f/0 run/0: product 0 is 2 diff --git a/cpp/.traces/reply_container b/cpp/.traces/reply_container index 9a5d430f..10cc9548 100644 --- a/cpp/.traces/reply_container +++ b/cpp/.traces/reply_container @@ -8,12 +8,12 @@ parse/0: ingredient: {name: "35", value: 0, type: 0, properties: ["35": "liter parse/0: product: {name: "13", value: 0, type: 1, properties: ["13": "integer"]} parse/0: instruction: 28 parse/0: ingredient: {name: "12", value: 0, type: 6, properties: ["12": "point"]} +after-brace/0: recipe main +after-brace/0: f ... after-brace/0: recipe f after-brace/0: next-ingredient ... after-brace/0: copy ... after-brace/0: reply ... -after-brace/0: recipe main -after-brace/0: f ... run/0: instruction main/0 run/0: instruction f/0 run/0: product 0 is 2 diff --git a/cpp/.traces/return_on_fallthrough b/cpp/.traces/return_on_fallthrough index 4408c63a..d7ac00e1 100644 --- a/cpp/.traces/return_on_fallthrough +++ b/cpp/.traces/return_on_fallthrough @@ -14,14 +14,14 @@ parse/0: product: {name: "4", value: 0, type: 1, properties: ["4": "integer"]} parse/0: instruction: 1 parse/0: ingredient: {name: "34", value: 0, type: 0, properties: ["34": "literal"]} parse/0: product: {name: "5", value: 0, type: 1, properties: ["5": "integer"]} -after-brace/0: recipe f -after-brace/0: copy ... -after-brace/0: copy ... after-brace/0: recipe main after-brace/0: f ... after-brace/0: copy ... after-brace/0: copy ... after-brace/0: copy ... +after-brace/0: recipe f +after-brace/0: copy ... +after-brace/0: copy ... run/0: instruction main/0 run/0: instruction f/0 run/0: ingredient 0 is 34 diff --git a/cpp/.traces/rewind_ingredients b/cpp/.traces/rewind_ingredients index 9c36302a..ed1bff38 100644 --- a/cpp/.traces/rewind_ingredients +++ b/cpp/.traces/rewind_ingredients @@ -9,13 +9,13 @@ parse/0: instruction: 26 parse/0: instruction: 25 parse/0: product: {name: "13", value: 0, type: 1, properties: ["13": "integer"]} parse/0: product: {name: "2", value: 0, type: 3, properties: ["2": "boolean"]} +after-brace/0: recipe main +after-brace/0: f ... after-brace/0: recipe f after-brace/0: next-ingredient ... after-brace/0: next-ingredient ... after-brace/0: rewind-ingredients ... after-brace/0: next-ingredient ... -after-brace/0: recipe main -after-brace/0: f ... run/0: instruction main/0 run/0: instruction f/0 run/0: product 0 is 2 diff --git a/cpp/003trace b/cpp/003trace index af4858bf..f2070bae 100644 --- a/cpp/003trace +++ b/cpp/003trace @@ -93,7 +93,7 @@ Hide_warnings = false; :(before "End Tracing") struct trace_stream { vector<pair<string, pair<int, string> > > past_lines; // [(layer label, frame, line)] - unordered_map<string, int> frame; + map<string, int> frame; // accumulator for current line ostringstream* curr_stream; string curr_layer; @@ -458,11 +458,10 @@ using std::vector; using std::list; #include<utility> using std::pair; - -#include<tr1/unordered_map> -using std::tr1::unordered_map; -#include<tr1/unordered_set> -using std::tr1::unordered_set; +#include<map> +using std::map; +#include<set> +using std::set; #include<algorithm> #include<iostream> diff --git a/cpp/010vm b/cpp/010vm index 76d41a71..48b68cdf 100644 --- a/cpp/010vm +++ b/cpp/010vm @@ -2,8 +2,8 @@ // A program is a book of 'recipes' (functions) typedef int recipe_number; :(before "End Globals") -unordered_map<string, recipe_number> Recipe_number; -unordered_map<recipe_number, recipe> Recipe; +map<string, recipe_number> Recipe_number; +map<recipe_number, recipe> Recipe; int Next_recipe_number = 1; :(before "End Types") @@ -56,7 +56,7 @@ struct property { :(before "End Globals") // Locations refer to a common 'memory'. Each location can store a number. -unordered_map<int, int> Memory; +map<int, int> Memory; :(before "End Setup") Memory.clear(); @@ -71,8 +71,8 @@ Memory.clear(); // seamless experience to help understand arbitrary mu programs. typedef int type_number; :(before "End Globals") -unordered_map<string, type_number> Type_number; -unordered_map<type_number, type_info> Type; +map<string, type_number> Type_number; +map<type_number, type_info> Type; int Next_type_number = 1; :(code) void setup_types() { diff --git a/cpp/012transform b/cpp/012transform index 59b87e69..888c7585 100644 --- a/cpp/012transform +++ b/cpp/012transform @@ -17,7 +17,7 @@ vector<transform_fn> Transform; void transform_all() { //? cout << "AAA transform_all\n"; //? 1 for (size_t t = 0; t < Transform.size(); ++t) { - for (unordered_map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { + for (map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { recipe& r = p->second; if (r.steps.empty()) continue; if (r.transformed_until != t-1) continue; @@ -30,7 +30,7 @@ void transform_all() { void parse_int_reagents() { //? cout << "parse_int_reagents\n"; //? 1 - for (unordered_map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { + for (map<recipe_number, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { recipe& r = p->second; if (r.steps.empty()) continue; for (size_t index = 0; index < r.steps.size(); ++index) { diff --git a/cpp/041name b/cpp/041name index 071f6f5a..6afb6b07 100644 --- a/cpp/041name +++ b/cpp/041name @@ -21,7 +21,7 @@ recipe main [ Transform.push_back(transform_names); :(before "End Globals") -unordered_map<recipe_number, unordered_map<string, int> > Name; +map<recipe_number, map<string, int> > Name; :(after "Clear Other State For recently_added_recipes") for (size_t i = 0; i < recently_added_recipes.size(); ++i) { Name.erase(recently_added_recipes[i]); @@ -29,7 +29,7 @@ for (size_t i = 0; i < recently_added_recipes.size(); ++i) { :(code) void transform_names(const recipe_number r) { - unordered_map<string, int>& names = Name[r]; + map<string, int>& names = Name[r]; int curr_idx = 1; //? cout << "Recipe " << r << '\n'; //? 2 //? cout << Recipe[r].steps.size(); //? 1 @@ -77,7 +77,7 @@ void transform_names(const recipe_number r) { } } -bool already_transformed(const reagent& r, const unordered_map<string, int>& names) { +bool already_transformed(const reagent& r, const map<string, int>& names) { return names.find(r.name) != names.end(); } diff --git a/cpp/054closure_name b/cpp/054closure_name index ea48694b..b6ba686a 100644 --- a/cpp/054closure_name +++ b/cpp/054closure_name @@ -35,7 +35,7 @@ recipe increment-counter [ //: surrounding space of each recipe. This must happen before transform_names. :(before "End Globals") -unordered_map<recipe_number, recipe_number> Surrounding_space; +map<recipe_number, recipe_number> Surrounding_space; :(after "int main") Transform.push_back(collect_surrounding_spaces); @@ -130,8 +130,8 @@ recipe_number lookup_surrounding_recipe(const recipe_number r, size_t n) { } //: weaken use-before-set warnings just a tad -:(replace{} "bool already_transformed(const reagent& r, const unordered_map<string, int>& names)") -bool already_transformed(const reagent& r, const unordered_map<string, int>& names) { +:(replace{} "bool already_transformed(const reagent& r, const map<string, int>& names)") +bool already_transformed(const reagent& r, const map<string, int>& names) { if (has_property(r, "space")) { vector<string> p = property(r, "space"); assert(p.size() == 1); @@ -139,7 +139,3 @@ bool already_transformed(const reagent& r, const unordered_map<string, int>& nam } return names.find(r.name) != names.end(); } - -:(before "End Includes") -#include<set> -using std::set; |