about summary refs log tree commit diff stats
path: root/cpp/012run
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-16 23:41:01 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-16 23:41:01 -0700
commitdecaddb418abcb6094e339f1b8dd4bb519b761ad (patch)
treebeab8c830e4dadb06b6b42cf239dfcbbc59db831 /cpp/012run
parenta4ef18b194a24710847be59554e51a1fd618228d (diff)
downloadmu-decaddb418abcb6094e339f1b8dd4bb519b761ad.tar.gz
941 - c++: basic break/loop conversion
Diffstat (limited to 'cpp/012run')
-rw-r--r--cpp/012run10
1 files changed, 10 insertions, 0 deletions
diff --git a/cpp/012run b/cpp/012run
index 8ae164c3..f4dd6390 100644
--- a/cpp/012run
+++ b/cpp/012run
@@ -36,6 +36,7 @@ void run(routine rr) {
     vector<instruction>& instructions = steps(rr);
     size_t& pc = running_at(rr);
     // Running one instruction.
+    if (instructions[pc].is_label) { ++pc; continue; }
     trace("run") << "instruction " << recipe_name(rr) << '/' << pc;
     switch (instructions[pc].operation) {
       // Primitive Recipe Implementations.
@@ -140,3 +141,12 @@ size_t size_of(reagent r) {
   if (!t.is_record && !t.is_array) return t.size;
   return t.size;  // TODO
 }
+
+:(scenario run_label)
+recipe main [
+  +foo
+  1:integer <- copy 23:literal
+  2:integer <- copy 1:integer
+]
++run: instruction main/1
++run: instruction main/2