about summary refs log tree commit diff stats
path: root/html/040brace.cc.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-11-10 21:35:42 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-11-10 21:43:45 -0800
commit76755b2836b0dadd88f82635f661f9d9df77604d (patch)
treef4f4429510c739fd1f9e51edd10e03c27107acba /html/040brace.cc.html
parent080e9cb73fa55cdc862f1dd7593df56e0a6302b8 (diff)
downloadmu-76755b2836b0dadd88f82635f661f9d9df77604d.tar.gz
2423 - describe shape-shifting in html docs
Diffstat (limited to 'html/040brace.cc.html')
-rw-r--r--html/040brace.cc.html244
1 files changed, 128 insertions, 116 deletions
diff --git a/html/040brace.cc.html b/html/040brace.cc.html
index eb62a889..6f994e22 100644
--- a/html/040brace.cc.html
+++ b/html/040brace.cc.html
@@ -13,13 +13,14 @@
 pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; }
 body { font-family: monospace; color: #eeeeee; background-color: #080808; }
 * { font-size: 1.05em; }
+.traceContains { color: #008000; }
 .cSpecial { color: #008000; }
+.CommentedCode { color: #6c6c6c; }
 .Comment { color: #9090ff; }
 .Delimiter { color: #a04060; }
 .Special { color: #ff6060; }
 .Identifier { color: #804000; }
 .Constant { color: #00a0a0; }
-.traceContains { color: #008000; }
 -->
 </style>
 
@@ -60,99 +61,108 @@ recipe main [
     <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: jump 1:offset</span>
-<span class="traceContains">+after-brace: copy ...</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: jump 1:offset</span>
+<span class="traceContains">+transform: copy ...</span>
 
-<span class="Comment">//: one-time setup</span>
-<span class="Delimiter">:(after &quot;int main&quot;)</span>
-  Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>transform_braces<span class="Delimiter">);</span>
+<span class="Delimiter">:(after &quot;Begin Transforms&quot;)</span>
+Transform<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>transform_braces<span class="Delimiter">);</span>  <span class="Comment">// idempotent</span>
 
 <span class="Delimiter">:(code)</span>
 void transform_braces<span class="Delimiter">(</span>const recipe_ordinal r<span class="Delimiter">)</span> <span class="Delimiter">{</span>
   const int OPEN = <span class="Constant">0</span><span class="Delimiter">,</span> CLOSE = <span class="Constant">1</span><span class="Delimiter">;</span>
   <span class="Comment">// use signed integer for step index because we'll be doing arithmetic on it</span>
   list&lt;pair&lt;int<span class="Comment">/*</span><span class="Comment">OPEN/CLOSE</span><span class="Comment">*/</span><span class="Delimiter">,</span> <span class="Comment">/*</span><span class="Comment">step</span><span class="Comment">*/</span>long long int&gt; &gt; braces<span class="Delimiter">;</span>
-  for <span class="Delimiter">(</span>long long int index = <span class="Constant">0</span><span class="Delimiter">;</span> index &lt; SIZE<span class="Delimiter">(</span>Recipe[r]<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span>
-    const instruction&amp; inst = Recipe[r]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span>
+  trace<span class="Delimiter">(</span><span class="Constant">9991</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;--- transform braces for recipe &quot;</span> &lt;&lt; get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name &lt;&lt; end<span class="Delimiter">();</span>
+<span class="CommentedCode">//?   cerr &lt;&lt; &quot;--- transform braces for recipe &quot; &lt;&lt; get(Recipe, r).name &lt;&lt; '\n';</span>
+  for <span class="Delimiter">(</span>long long int index = <span class="Constant">0</span><span class="Delimiter">;</span> index &lt; SIZE<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+    const instruction&amp; inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span>
     if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label == <span class="Constant">&quot;{&quot;</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
-      trace<span class="Delimiter">(</span><span class="Constant">&quot;brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; Recipe[r]<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">&quot;: push (open, &quot;</span> &lt;&lt; index &lt;&lt; <span class="Constant">&quot;)&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+      trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; maybe<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;push (open, &quot;</span> &lt;&lt; index &lt;&lt; <span class="Constant">&quot;)&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
       braces<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair&lt;int<span class="Delimiter">,</span>long long int&gt;<span class="Delimiter">(</span>OPEN<span class="Delimiter">,</span> index<span class="Delimiter">));</span>
     <span class="Delimiter">}</span>
     if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label == <span class="Constant">&quot;}&quot;</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
-      trace<span class="Delimiter">(</span><span class="Constant">&quot;brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;push (close, &quot;</span> &lt;&lt; index &lt;&lt; <span class="Constant">&quot;)&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+      trace<span class="Delimiter">(</span><span class="Constant">9993</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;push (close, &quot;</span> &lt;&lt; index &lt;&lt; <span class="Constant">&quot;)&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
       braces<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>pair&lt;int<span class="Delimiter">,</span>long long int&gt;<span class="Delimiter">(</span>CLOSE<span class="Delimiter">,</span> index<span class="Delimiter">));</span>
     <span class="Delimiter">}</span>
   <span class="Delimiter">}</span>
   stack&lt;<span class="Comment">/*</span><span class="Comment">step</span><span class="Comment">*/</span>long long int&gt; open_braces<span class="Delimiter">;</span>
-  trace<span class="Delimiter">(</span><span class="Constant">&quot;after-brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;recipe &quot;</span> &lt;&lt; Recipe[r]<span class="Delimiter">.</span>name &lt;&lt; end<span class="Delimiter">();</span>
-  for <span class="Delimiter">(</span>long long int index = <span class="Constant">0</span><span class="Delimiter">;</span> index &lt; SIZE<span class="Delimiter">(</span>Recipe[r]<span class="Delimiter">.</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span>
-    instruction&amp; inst = Recipe[r]<span class="Delimiter">.</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span>
+  for <span class="Delimiter">(</span>long long int index = <span class="Constant">0</span><span class="Delimiter">;</span> index &lt; SIZE<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span> ++index<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+    instruction&amp; inst = get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">.</span>at<span class="Delimiter">(</span>index<span class="Delimiter">);</span>
     if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label == <span class="Constant">&quot;{&quot;</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
       open_braces<span class="Delimiter">.</span>push<span class="Delimiter">(</span>index<span class="Delimiter">);</span>
       <span class="Identifier">continue</span><span class="Delimiter">;</span>
     <span class="Delimiter">}</span>
     if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>label == <span class="Constant">&quot;}&quot;</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
+      if <span class="Delimiter">(</span>open_braces<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span>
+        raise &lt;&lt; <span class="Constant">&quot;missing '{' in &quot;</span> &lt;&lt; get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name &lt;&lt; <span class="cSpecial">'\n'</span><span class="Delimiter">;</span>
+        <span class="Identifier">return</span><span class="Delimiter">;</span>
+      <span class="Delimiter">}</span>
       open_braces<span class="Delimiter">.</span>pop<span class="Delimiter">();</span>
       <span class="Identifier">continue</span><span class="Delimiter">;</span>
     <span class="Delimiter">}</span>
     if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>is_label<span class="Delimiter">)</span> <span class="Identifier">continue</span><span class="Delimiter">;</span>
-    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>operation != Recipe_ordinal[<span class="Constant">&quot;loop&quot;</span>]
-         &amp;&amp; inst<span class="Delimiter">.</span>operation != Recipe_ordinal[<span class="Constant">&quot;loop-if&quot;</span>]
-         &amp;&amp; inst<span class="Delimiter">.</span>operation != Recipe_ordinal[<span class="Constant">&quot;loop-unless&quot;</span>]
-         &amp;&amp; inst<span class="Delimiter">.</span>operation != Recipe_ordinal[<span class="Constant">&quot;break&quot;</span>]
-         &amp;&amp; inst<span class="Delimiter">.</span>operation != Recipe_ordinal[<span class="Constant">&quot;break-if&quot;</span>]
-         &amp;&amp; inst<span class="Delimiter">.</span>operation != Recipe_ordinal[<span class="Constant">&quot;break-unless&quot;</span>]<span class="Delimiter">)</span> <span class="Delimiter">{</span>
-      trace<span class="Delimiter">(</span><span class="Constant">&quot;after-brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; inst<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">&quot; ...&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>old_name != <span class="Constant">&quot;loop&quot;</span>
+         &amp;&amp; inst<span class="Delimiter">.</span>old_name != <span class="Constant">&quot;loop-if&quot;</span>
+         &amp;&amp; inst<span class="Delimiter">.</span>old_name != <span class="Constant">&quot;loop-unless&quot;</span>
+         &amp;&amp; inst<span class="Delimiter">.</span>old_name != <span class="Constant">&quot;break&quot;</span>
+         &amp;&amp; inst<span class="Delimiter">.</span>old_name != <span class="Constant">&quot;break-if&quot;</span>
+         &amp;&amp; inst<span class="Delimiter">.</span>old_name != <span class="Constant">&quot;break-unless&quot;</span><span class="Delimiter">)</span> <span class="Delimiter">{</span>
+      trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; inst<span class="Delimiter">.</span>old_name &lt;&lt; <span class="Constant">&quot; ...&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
       <span class="Identifier">continue</span><span class="Delimiter">;</span>
     <span class="Delimiter">}</span>
     <span class="Comment">// check for errors</span>
-    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-if&quot;</span><span class="Delimiter">)</span> != string::npos || inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-unless&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>old_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-if&quot;</span><span class="Delimiter">)</span> != string::npos || inst<span class="Delimiter">.</span>old_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-unless&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span>
       if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">())</span> <span class="Delimiter">{</span>
-        raise &lt;&lt; inst<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">&quot; expects 1 or 2 ingredients, but got none</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+        raise_error &lt;&lt; inst<span class="Delimiter">.</span>old_name &lt;&lt; <span class="Constant">&quot; expects 1 or 2 ingredients, but got none</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
         <span class="Identifier">continue</span><span class="Delimiter">;</span>
       <span class="Delimiter">}</span>
     <span class="Delimiter">}</span>
     <span class="Comment">// update instruction operation</span>
-    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-if&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span>
-      inst<span class="Delimiter">.</span>operation = Recipe_ordinal[<span class="Constant">&quot;jump-if&quot;</span>]<span class="Delimiter">;</span>
-    else if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-unless&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span>
-      inst<span class="Delimiter">.</span>operation = Recipe_ordinal[<span class="Constant">&quot;jump-unless&quot;</span>]<span class="Delimiter">;</span>
-    else
-      inst<span class="Delimiter">.</span>operation = Recipe_ordinal[<span class="Constant">&quot;jump&quot;</span>]<span class="Delimiter">;</span>
+    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>old_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-if&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+      inst<span class="Delimiter">.</span>name = <span class="Constant">&quot;jump-if&quot;</span><span class="Delimiter">;</span>
+      inst<span class="Delimiter">.</span>operation = JUMP_IF<span class="Delimiter">;</span>
+    <span class="Delimiter">}</span>
+    else if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>old_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-unless&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+      inst<span class="Delimiter">.</span>name = <span class="Constant">&quot;jump-unless&quot;</span><span class="Delimiter">;</span>
+      inst<span class="Delimiter">.</span>operation = JUMP_UNLESS<span class="Delimiter">;</span>
+    <span class="Delimiter">}</span>
+    else <span class="Delimiter">{</span>
+      inst<span class="Delimiter">.</span>name = <span class="Constant">&quot;jump&quot;</span><span class="Delimiter">;</span>
+      inst<span class="Delimiter">.</span>operation = JUMP<span class="Delimiter">;</span>
+    <span class="Delimiter">}</span>
     <span class="Comment">// check for explicitly provided targets</span>
-    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-if&quot;</span><span class="Delimiter">)</span> != string::npos || inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-unless&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span>
+    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>old_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-if&quot;</span><span class="Delimiter">)</span> != string::npos || inst<span class="Delimiter">.</span>old_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-unless&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span> <span class="Delimiter">{</span>
       <span class="Comment">// conditional branches check arg 1</span>
       if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">)</span> &gt; <span class="Constant">1</span> &amp;&amp; is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span>
-        trace<span class="Delimiter">(</span><span class="Constant">&quot;after-brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;jump &quot;</span> &lt;&lt; inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+        trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; inst<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">' '</span> &lt;&lt; inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>name &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
         <span class="Identifier">continue</span><span class="Delimiter">;</span>
       <span class="Delimiter">}</span>
     <span class="Delimiter">}</span>
     else <span class="Delimiter">{</span>
       <span class="Comment">// unconditional branches check arg 0</span>
       if <span class="Delimiter">(</span>!inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>empty<span class="Delimiter">()</span> &amp;&amp; is_literal<span class="Delimiter">(</span>inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)))</span> <span class="Delimiter">{</span>
-        trace<span class="Delimiter">(</span><span class="Constant">&quot;after-brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;jump &quot;</span> &lt;&lt; inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+        trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;jump &quot;</span> &lt;&lt; inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
         <span class="Identifier">continue</span><span class="Delimiter">;</span>
       <span class="Delimiter">}</span>
     <span class="Delimiter">}</span>
     <span class="Comment">// if implicit, compute target</span>
     reagent target<span class="Delimiter">;</span>
-    target<span class="Delimiter">.</span>types<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>Type_ordinal[<span class="Constant">&quot;offset&quot;</span>]<span class="Delimiter">);</span>
+    target<span class="Delimiter">.</span>type = new type_tree<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Type_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;offset&quot;</span><span class="Delimiter">));</span>
+    target<span class="Delimiter">.</span>properties<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>second = new string_tree<span class="Delimiter">(</span><span class="Constant">&quot;offset&quot;</span><span class="Delimiter">);</span>
     target<span class="Delimiter">.</span>set_value<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span>
     if <span class="Delimiter">(</span>open_braces<span class="Delimiter">.</span>empty<span class="Delimiter">())</span>
-      raise &lt;&lt; inst<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">&quot; needs a '{' before</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
-    else if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;loop&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span>
+      raise_error &lt;&lt; inst<span class="Delimiter">.</span>old_name &lt;&lt; <span class="Constant">&quot; needs a '{' before</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+    else if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>old_name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;loop&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span>
       target<span class="Delimiter">.</span>set_value<span class="Delimiter">(</span>open_braces<span class="Delimiter">.</span>top<span class="Delimiter">()</span>-index<span class="Delimiter">);</span>
     else  <span class="Comment">// break instruction</span>
       target<span class="Delimiter">.</span>set_value<span class="Delimiter">(</span>matching_brace<span class="Delimiter">(</span>open_braces<span class="Delimiter">.</span>top<span class="Delimiter">(),</span> braces<span class="Delimiter">,</span> r<span class="Delimiter">)</span> - index - <span class="Constant">1</span><span class="Delimiter">);</span>
     inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>target<span class="Delimiter">);</span>
     <span class="Comment">// log computed target</span>
-    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-if&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span>
-      trace<span class="Delimiter">(</span><span class="Constant">&quot;after-brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;jump-if &quot;</span> &lt;&lt; inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name &lt;&lt; <span class="Constant">&quot;, &quot;</span> &lt;&lt; target<span class="Delimiter">.</span>value &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
-    else if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name<span class="Delimiter">.</span>find<span class="Delimiter">(</span><span class="Constant">&quot;-unless&quot;</span><span class="Delimiter">)</span> != string::npos<span class="Delimiter">)</span>
-      trace<span class="Delimiter">(</span><span class="Constant">&quot;after-brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;jump-unless &quot;</span> &lt;&lt; inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name &lt;&lt; <span class="Constant">&quot;, &quot;</span> &lt;&lt; target<span class="Delimiter">.</span>value &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+    if <span class="Delimiter">(</span>inst<span class="Delimiter">.</span>name == <span class="Constant">&quot;jump&quot;</span><span class="Delimiter">)</span>
+      trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;jump &quot;</span> &lt;&lt; no_scientific<span class="Delimiter">(</span>target<span class="Delimiter">.</span>value<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
     else
-      trace<span class="Delimiter">(</span><span class="Constant">&quot;after-brace&quot;</span><span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;jump &quot;</span> &lt;&lt; target<span class="Delimiter">.</span>value &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+      trace<span class="Delimiter">(</span><span class="Constant">9992</span><span class="Delimiter">,</span> <span class="Constant">&quot;transform&quot;</span><span class="Delimiter">)</span> &lt;&lt; inst<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">' '</span> &lt;&lt; inst<span class="Delimiter">.</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>name &lt;&lt; <span class="Constant">&quot;, &quot;</span> &lt;&lt; no_scientific<span class="Delimiter">(</span>target<span class="Delimiter">.</span>value<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;:offset&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
   <span class="Delimiter">}</span>
 <span class="Delimiter">}</span>
 
@@ -165,34 +175,10 @@ long long int matching_brace<span class="Delimiter">(</span>long long int index<
     stacksize += <span class="Delimiter">(</span>p<span class="Delimiter">-&gt;</span>first ? <span class="Constant">1</span> : -<span class="Constant">1</span><span class="Delimiter">);</span>
     if <span class="Delimiter">(</span>stacksize == <span class="Constant">0</span><span class="Delimiter">)</span> <span class="Identifier">return</span> p<span class="Delimiter">-&gt;</span>second<span class="Delimiter">;</span>
   <span class="Delimiter">}</span>
-  raise &lt;&lt; Recipe[r]<span class="Delimiter">.</span>name &lt;&lt; <span class="Constant">&quot;: unbalanced '{'</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
-  <span class="Identifier">return</span> SIZE<span class="Delimiter">(</span>Recipe[r]<span class="Delimiter">.</span>steps<span class="Delimiter">);</span>  <span class="Comment">// exit current routine</span>
+  raise_error &lt;&lt; maybe<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>name<span class="Delimiter">)</span> &lt;&lt; <span class="Constant">&quot;unbalanced '{'</span><span class="cSpecial">\n</span><span class="Constant">&quot;</span> &lt;&lt; end<span class="Delimiter">();</span>
+  <span class="Identifier">return</span> SIZE<span class="Delimiter">(</span>get<span class="Delimiter">(</span>Recipe<span class="Delimiter">,</span> r<span class="Delimiter">).</span>steps<span class="Delimiter">);</span>  <span class="Comment">// exit current routine</span>
 <span class="Delimiter">}</span>
 
-<span class="Comment">// temporarily suppress run</span>
-void transform<span class="Delimiter">(</span>string form<span class="Delimiter">)</span> <span class="Delimiter">{</span>
-  load<span class="Delimiter">(</span>form<span class="Delimiter">);</span>
-  transform_all<span class="Delimiter">();</span>
-<span class="Delimiter">}</span>
-
-<span class="Comment">//: Make sure these pseudo recipes get consistent numbers in all tests, even</span>
-<span class="Comment">//: though they aren't implemented.</span>
-
-<span class="Delimiter">:(before &quot;End Primitive Recipe Declarations&quot;)</span>
-BREAK<span class="Delimiter">,</span>
-BREAK_IF<span class="Delimiter">,</span>
-BREAK_UNLESS<span class="Delimiter">,</span>
-LOOP<span class="Delimiter">,</span>
-LOOP_IF<span class="Delimiter">,</span>
-LOOP_UNLESS<span class="Delimiter">,</span>
-<span class="Delimiter">:(before &quot;End Primitive Recipe Numbers&quot;)</span>
-Recipe_ordinal[<span class="Constant">&quot;break&quot;</span>] = BREAK<span class="Delimiter">;</span>
-Recipe_ordinal[<span class="Constant">&quot;break-if&quot;</span>] = BREAK_IF<span class="Delimiter">;</span>
-Recipe_ordinal[<span class="Constant">&quot;break-unless&quot;</span>] = BREAK_UNLESS<span class="Delimiter">;</span>
-Recipe_ordinal[<span class="Constant">&quot;loop&quot;</span>] = LOOP<span class="Delimiter">;</span>
-Recipe_ordinal[<span class="Constant">&quot;loop-if&quot;</span>] = LOOP_IF<span class="Delimiter">;</span>
-Recipe_ordinal[<span class="Constant">&quot;loop-unless&quot;</span>] = LOOP_UNLESS<span class="Delimiter">;</span>
-
 <span class="Delimiter">:(scenario loop)</span>
 recipe main [
   <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
@@ -202,11 +188,11 @@ recipe main [
     loop
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump -2:offset</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump -2:offset</span>
 
 <span class="Delimiter">:(scenario break_empty_block)</span>
 recipe main [
@@ -215,9 +201,9 @@ recipe main [
     <span class="Identifier">break</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump 0:offset</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump 0:offset</span>
 
 <span class="Delimiter">:(scenario break_cascading)</span>
 recipe main [
@@ -229,10 +215,10 @@ recipe main [
     <span class="Identifier">break</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump 0:offset</span>
-<span class="traceContains">+after-brace: jump 0:offset</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump 0:offset</span>
+<span class="traceContains">+transform: jump 0:offset</span>
 
 <span class="Delimiter">:(scenario break_cascading_2)</span>
 recipe main [
@@ -246,12 +232,12 @@ recipe main [
     <span class="Identifier">break</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump 1:offset</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump 0:offset</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump 1:offset</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump 0:offset</span>
 
 <span class="Delimiter">:(scenario break_if)</span>
 recipe main [
@@ -265,12 +251,12 @@ recipe main [
     <span class="Identifier">break</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump-if 2, 1:offset</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump 0:offset</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump-if 2, 1:offset</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump 0:offset</span>
 
 <span class="Delimiter">:(scenario break_nested)</span>
 recipe main [
@@ -284,7 +270,7 @@ recipe main [
     <span class="Constant">4</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: jump 4:offset</span>
+<span class="traceContains">+transform: jump 4:offset</span>
 
 <span class="Delimiter">:(scenario break_nested_degenerate)</span>
 recipe main [
@@ -297,7 +283,7 @@ recipe main [
     <span class="Constant">4</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: jump 3:offset</span>
+<span class="traceContains">+transform: jump 3:offset</span>
 
 <span class="Delimiter">:(scenario break_nested_degenerate_2)</span>
 recipe main [
@@ -309,17 +295,17 @@ recipe main [
     <span class="Delimiter">}</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: jump 2:offset</span>
+<span class="traceContains">+transform: jump 2:offset</span>
 
 <span class="Delimiter">:(scenario break_label)</span>
-<span class="Special">% Hide_warnings = true;</span>
+<span class="Special">% Hide_errors = true;</span>
 recipe main [
   <span class="Constant">1</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Delimiter">{</span>
     <span class="Identifier">break</span> +foo:offset
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: jump +foo:offset</span>
+<span class="traceContains">+transform: jump +foo:offset</span>
 
 <span class="Delimiter">:(scenario break_unless)</span>
 recipe main [
@@ -330,11 +316,11 @@ recipe main [
     <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump-unless 2, 1:offset</span>
-<span class="traceContains">+after-brace: copy ...</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump-unless 2, 1:offset</span>
+<span class="traceContains">+transform: copy ...</span>
 
 <span class="Delimiter">:(scenario loop_unless)</span>
 recipe main [
@@ -345,11 +331,11 @@ recipe main [
     <span class="Constant">3</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: jump-unless 2, -1:offset</span>
-<span class="traceContains">+after-brace: copy ...</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: jump-unless 2, -1:offset</span>
+<span class="traceContains">+transform: copy ...</span>
 
 <span class="Delimiter">:(scenario loop_nested)</span>
 recipe main [
@@ -363,8 +349,8 @@ recipe main [
     <span class="Constant">5</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: jump-if 4, -5:offset</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: jump-if 4, -5:offset</span>
 
 <span class="Delimiter">:(scenario loop_label)</span>
 recipe main [
@@ -372,9 +358,9 @@ recipe main [
   +foo
   <span class="Constant">2</span>:number<span class="Special"> &lt;- </span>copy <span class="Constant">0</span>
 ]
-<span class="traceContains">+after-brace: recipe main</span>
-<span class="traceContains">+after-brace: copy ...</span>
-<span class="traceContains">+after-brace: copy ...</span>
+<span class="traceContains">+transform: --- transform braces for recipe main</span>
+<span class="traceContains">+transform: copy ...</span>
+<span class="traceContains">+transform: copy ...</span>
 
 <span class="Comment">//: test how things actually run</span>
 <span class="Delimiter">:(scenarios run)</span>
@@ -394,21 +380,47 @@ recipe test-factorial [
 ]
 <span class="traceContains">+mem: location 2 is 120</span>
 
-<span class="Delimiter">:(scenario break_outside_braces_warns)</span>
-<span class="Special">% Hide_warnings = true;</span>
+<span class="Delimiter">:(scenario break_outside_braces_fails)</span>
+<span class="Special">% Hide_errors = true;</span>
 recipe main [
   <span class="Identifier">break</span>
 ]
-<span class="traceContains">+warn: break needs a '{' before</span>
+<span class="traceContains">+error: break needs a '{' before</span>
 
-<span class="Delimiter">:(scenario break_conditional_without_ingredient_warns)</span>
-<span class="Special">% Hide_warnings = true;</span>
+<span class="Delimiter">:(scenario break_conditional_without_ingredient_fails)</span>
+<span class="Special">% Hide_errors = true;</span>
 recipe main [
   <span class="Delimiter">{</span>
     <span class="Identifier">break</span>-if
   <span class="Delimiter">}</span>
 ]
-<span class="traceContains">+warn: break-if expects 1 or 2 ingredients, but got none</span>
+<span class="traceContains">+error: break-if expects 1 or 2 ingredients, but got none</span>
+
+<span class="Comment">//: Make sure these pseudo recipes get consistent numbers in all tests, even</span>
+<span class="Comment">//: though they aren't implemented. Allows greater flexibility in ordering</span>
+<span class="Comment">//: transforms.</span>
+
+<span class="Delimiter">:(before &quot;End Primitive Recipe Declarations&quot;)</span>
+BREAK<span class="Delimiter">,</span>
+BREAK_IF<span class="Delimiter">,</span>
+BREAK_UNLESS<span class="Delimiter">,</span>
+LOOP<span class="Delimiter">,</span>
+LOOP_IF<span class="Delimiter">,</span>
+LOOP_UNLESS<span class="Delimiter">,</span>
+<span class="Delimiter">:(before &quot;End Primitive Recipe Numbers&quot;)</span>
+put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;break&quot;</span><span class="Delimiter">,</span> BREAK<span class="Delimiter">);</span>
+put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;break-if&quot;</span><span class="Delimiter">,</span> BREAK_IF<span class="Delimiter">);</span>
+put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;break-unless&quot;</span><span class="Delimiter">,</span> BREAK_UNLESS<span class="Delimiter">);</span>
+put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;loop&quot;</span><span class="Delimiter">,</span> LOOP<span class="Delimiter">);</span>
+put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;loop-if&quot;</span><span class="Delimiter">,</span> LOOP_IF<span class="Delimiter">);</span>
+put<span class="Delimiter">(</span>Recipe_ordinal<span class="Delimiter">,</span> <span class="Constant">&quot;loop-unless&quot;</span><span class="Delimiter">,</span> LOOP_UNLESS<span class="Delimiter">);</span>
+<span class="Delimiter">:(before &quot;End Primitive Recipe Checks&quot;)</span>
+case BREAK: <span class="Identifier">break</span><span class="Delimiter">;</span>
+case BREAK_IF: <span class="Identifier">break</span><span class="Delimiter">;</span>
+case BREAK_UNLESS: <span class="Identifier">break</span><span class="Delimiter">;</span>
+case LOOP: <span class="Identifier">break</span><span class="Delimiter">;</span>
+case LOOP_IF: <span class="Identifier">break</span><span class="Delimiter">;</span>
+case LOOP_UNLESS: <span class="Identifier">break</span><span class="Delimiter">;</span>
 </pre>
 </body>
 </html>