about summary refs log tree commit diff stats
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/012run18
1 files changed, 17 insertions, 1 deletions
diff --git a/cpp/012run b/cpp/012run
index 9696da43..2b14fd4b 100644
--- a/cpp/012run
+++ b/cpp/012run
@@ -7,6 +7,16 @@ recipe main [
 +run: ingredient 0 is 23
 +mem: storing in location 1
 
+:(scenario copy)
+recipe main [
+  1:integer <- copy 23:literal
+  2:integer <- copy 1:integer
+]
++run: instruction 1
++mem: location 1 is 23
++run: ingredient 0 is 23
++mem: storing in location 2
+
 :(code)
 void run(string form) {
   run(add_recipe(form));
@@ -33,7 +43,13 @@ void run(recipe_number r) {
 
 vector<int> read_memory(reagent x) {
   vector<int> result;
-  result.push_back(to_int(x.name));
+  if (x.types[0] == 0) {  // literal
+    result.push_back(to_int(x.name));
+    return result;
+  }
+  int val = Memory[to_int(x.name)];
+  trace("mem") << "location " << x.name << " is " << val;
+  result.push_back(val);
   return result;
 }