about summary refs log tree commit diff stats
path: root/cpp
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-04-03 10:33:17 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-04-03 10:33:17 -0700
commitc027f09219b56aec206c63e981209b6423a5a9a5 (patch)
treea66fa5ee2ccb0ff212921057e5499ff0c861fde4 /cpp
parent3ae7e543047fe4351a5421519de277052a2bc240 (diff)
downloadmu-c027f09219b56aec206c63e981209b6423a5a9a5.tar.gz
1007
Diffstat (limited to 'cpp')
-rw-r--r--cpp/.traces/convert_names_passes_default_space3
-rw-r--r--cpp/.traces/factorial4
-rw-r--r--cpp/.traces/loop4
-rw-r--r--cpp/.traces/set_default_space1
-rw-r--r--cpp/.traces/surrounding_space1
-rw-r--r--cpp/010vm7
-rw-r--r--cpp/027space2
7 files changed, 11 insertions, 11 deletions
diff --git a/cpp/.traces/convert_names_passes_default_space b/cpp/.traces/convert_names_passes_default_space
index 04a3ce44..d11e038c 100644
--- a/cpp/.traces/convert_names_passes_default_space
+++ b/cpp/.traces/convert_names_passes_default_space
@@ -1,10 +1,9 @@
 parse/0: instruction: 1
 parse/0:   ingredient: {name: "0", value: 0, type: 0, properties: ["0": "literal"]}
-parse/0:   product: {name: "default_space", value: 0, type: 1, properties: ["default_space": "integer"]}
+parse/0:   product: {name: "default-space", value: 0, type: 1, properties: ["default-space": "integer"]}
 parse/0:   product: {name: "x", value: 0, type: 1, properties: ["x": "integer"]}
 name/0: assign x 1
 after-brace/0: recipe main
 after-brace/0: copy ...
 run/0: instruction main/0
 run/0: ingredient 0 is 0
-mem/0: storing 0 in location 0
diff --git a/cpp/.traces/factorial b/cpp/.traces/factorial
index 4b90d290..050b8bbe 100644
--- a/cpp/.traces/factorial
+++ b/cpp/.traces/factorial
@@ -34,8 +34,8 @@ after-brace/0: jump-if 3, 3:offset
 after-brace/0: multiply ...
 after-brace/0: subtract ...
 after-brace/0: jump -5:offset
-after-brace/0: 7: {name: "", value: -5, type: }
-after-brace/0: 7: {name: "", value: -5, type: }
+after-brace/0: 7: {name: "", value: -5, type: , properties: ["": ]}
+after-brace/0: 7: {name: "", value: -5, type: , properties: ["": ]}
 after-brace/0: copy ...
 run/0: instruction factorial/0
 run/0: ingredient 0 is 5
diff --git a/cpp/.traces/loop b/cpp/.traces/loop
index 4191e4df..11685d5d 100644
--- a/cpp/.traces/loop
+++ b/cpp/.traces/loop
@@ -17,5 +17,5 @@ after-brace/0: copy ...
 after-brace/0: copy ...
 after-brace/0: copy ...
 after-brace/0: jump -2:offset
-after-brace/0: 4: {name: "", value: -2, type: }
-after-brace/0: 4: {name: "", value: -2, type: }
+after-brace/0: 4: {name: "", value: -2, type: , properties: ["": ]}
+after-brace/0: 4: {name: "", value: -2, type: , properties: ["": ]}
diff --git a/cpp/.traces/set_default_space b/cpp/.traces/set_default_space
index 618aeb19..627719aa 100644
--- a/cpp/.traces/set_default_space
+++ b/cpp/.traces/set_default_space
@@ -7,7 +7,6 @@ parse/0:   product: {name: "default-space", value: 0, type: 2-0, properties: ["d
 parse/0: instruction: 1
 parse/0:   ingredient: {name: "23", value: 0, type: 0, properties: ["23": "literal"]}
 parse/0:   product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]}
-name/0: assign default-space 1
 after-brace/0: recipe main
 after-brace/0: copy ...
 after-brace/0: copy ...
diff --git a/cpp/.traces/surrounding_space b/cpp/.traces/surrounding_space
index 87391ba7..0f1371d5 100644
--- a/cpp/.traces/surrounding_space
+++ b/cpp/.traces/surrounding_space
@@ -16,7 +16,6 @@ parse/0:   product: {name: "1", value: 0, type: 1, properties: ["1": "integer"]}
 parse/0: instruction: 1
 parse/0:   ingredient: {name: "33", value: 0, type: 0, properties: ["33": "literal"]}
 parse/0:   product: {name: "1", value: 0, type: 1, properties: ["1": "integer", "space": "1"]}
-name/0: assign default-space 1
 after-brace/0: recipe main
 after-brace/0: copy ...
 after-brace/0: copy ...
diff --git a/cpp/010vm b/cpp/010vm
index 39159e40..8363720c 100644
--- a/cpp/010vm
+++ b/cpp/010vm
@@ -173,7 +173,12 @@ void setup_recipes() {
       properties[0].second.push_back("literal-string");
     }
   }
-  reagent::reagent() :value(0), initialized(false) {}
+  reagent::reagent() :value(0), initialized(false) {
+    // The first property is special, so ensure we always have it.
+    // Other properties can be pushed back, but the first must always be
+    // assigned to.
+    properties.push_back(pair<string, vector<string> >("", vector<string>()));
+  }
   string reagent::to_string() {
     ostringstream out;
     out << "{name: \"" << name << "\", value: " << value << ", type: ";
diff --git a/cpp/027space b/cpp/027space
index 11eb36c5..07ac5aa6 100644
--- a/cpp/027space
+++ b/cpp/027space
@@ -29,8 +29,6 @@ reagent absolutize(reagent x) {
   reagent r = x;
   r.set_value(address(r.value, space(r)));
 //?   cout << "after absolutize: " << r.value << '\n'; //? 1
-  if (r.properties.empty())
-    r.properties.push_back(pair<string, vector<string> >("", vector<string>()));
   r.properties.push_back(pair<string, vector<string> >("raw", vector<string>()));
   assert(is_raw(r));
   return r;