diff options
Diffstat (limited to 'html/023jump.cc.html')
-rw-r--r-- | html/023jump.cc.html | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/html/023jump.cc.html b/html/023jump.cc.html index 16a89563..472a964b 100644 --- a/html/023jump.cc.html +++ b/html/023jump.cc.html @@ -13,16 +13,15 @@ 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; } -.traceAbsent { color: #c00000; } -.Constant { color: #00a0a0; } +.traceContains { color: #008000; } .cSpecial { color: #008000; } -.Normal { color: #eeeeee; background-color: #080808; padding-bottom: 1px; } -.Special { color: #ff6060; } +.Constant { color: #00a0a0; } +.traceAbsent { color: #c00000; } .Comment { color: #9090ff; } .Delimiter { color: #a04060; } +.Special { color: #ff6060; } .CommentedCode { color: #6c6c6c; } .Identifier { color: #804000; } -.traceContains { color: #008000; } --> </style> @@ -40,10 +39,10 @@ body { font-family: monospace; color: #eeeeee; background-color: #080808; } <span class="CommentedCode">#? % Trace_stream->dump_layer = "all"; #? 1</span> recipe main [ jump <span class="Constant">1</span>:offset - <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span> ] <span class="traceContains">+run: jump 1:offset</span> -<span class="traceAbsent">-run: 1:number <- copy 1:literal</span> +<span class="traceAbsent">-run: 1:number <- copy 1</span> <span class="traceAbsent">-mem: storing 1 in location 1</span> <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> @@ -51,12 +50,12 @@ JUMP<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_ordinal[<span class="Constant">"jump"</span>] = JUMP<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span class="Normal">case</span> JUMP: <span class="Delimiter">{</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +case JUMP: <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">1</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'jump' requires exactly one ingredient, but got "</span> << current_instruction<span class="Delimiter">().</span>to_string<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<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> + if <span class="Delimiter">(</span>!scalar<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> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": first ingredient of 'jump' should be a label or offset, but got "</span> << current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -86,21 +85,21 @@ JUMP_IF<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_ordinal[<span class="Constant">"jump-if"</span>] = JUMP_IF<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span class="Normal">case</span> JUMP_IF: <span class="Delimiter">{</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +case JUMP_IF: <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'jump-if' requires exactly two ingredients, but got "</span> << current_instruction<span class="Delimiter">().</span>to_string<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<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> + if <span class="Delimiter">(</span>!scalar<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> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'jump-if' requires a boolean for its first ingredient, but got "</span> << current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<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> + if <span class="Delimiter">(</span>!scalar<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> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'jump-if' requires a label or offset for its second ingredient, but got "</span> << current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> assert<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>initialized<span class="Delimiter">);</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>!ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><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>Primitive_recipe_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jump-if fell through"</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -111,22 +110,22 @@ Recipe_ordinal[<span class="Constant">"jump-if"</span>] = JUMP_IF<span <span class="Delimiter">:(scenario jump_if)</span> recipe main [ - jump-<span class="Normal">if</span> <span class="Constant">999</span>:literal<span class="Delimiter">,</span> <span class="Constant">1</span>:offset - <span class="Constant">123</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal + jump-if <span class="Constant">999</span><span class="Delimiter">,</span> <span class="Constant">1</span>:offset + <span class="Constant">123</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span> ] -<span class="traceContains">+run: jump-if 999:literal, 1:offset</span> +<span class="traceContains">+run: jump-if 999, 1:offset</span> <span class="traceContains">+run: jumping to instruction 2</span> -<span class="traceAbsent">-run: 1:number <- copy 1:literal</span> +<span class="traceAbsent">-run: 1:number <- copy 1</span> <span class="traceAbsent">-mem: storing 1 in location 123</span> <span class="Delimiter">:(scenario jump_if_fallthrough)</span> recipe main [ - jump-<span class="Normal">if</span> <span class="Constant">0</span>:literal<span class="Delimiter">,</span> <span class="Constant">1</span>:offset - <span class="Constant">123</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal + jump-if <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span>:offset + <span class="Constant">123</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span> ] -<span class="traceContains">+run: jump-if 0:literal, 1:offset</span> +<span class="traceContains">+run: jump-if 0, 1:offset</span> <span class="traceContains">+run: jump-if fell through</span> -<span class="traceContains">+run: 123:number <- copy 1:literal</span> +<span class="traceContains">+run: 123:number <- copy 1</span> <span class="traceContains">+mem: storing 1 in location 123</span> <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> @@ -134,21 +133,21 @@ JUMP_UNLESS<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_ordinal[<span class="Constant">"jump-unless"</span>] = JUMP_UNLESS<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> -<span class="Normal">case</span> JUMP_UNLESS: <span class="Delimiter">{</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> +case JUMP_UNLESS: <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>SIZE<span class="Delimiter">(</span>ingredients<span class="Delimiter">)</span> != <span class="Constant">2</span><span class="Delimiter">)</span> <span class="Delimiter">{</span> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'jump-unless' requires exactly two ingredients, but got "</span> << current_instruction<span class="Delimiter">().</span>to_string<span class="Delimiter">()</span> << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<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> + if <span class="Delimiter">(</span>!scalar<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> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'jump-unless' requires a boolean for its first ingredient, but got "</span> << current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>!scalar<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> + if <span class="Delimiter">(</span>!scalar<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> raise << current_recipe_name<span class="Delimiter">()</span> << <span class="Constant">": 'jump-unless' requires a label or offset for its second ingredient, but got "</span> << current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>original_string << <span class="cSpecial">'\n'</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> assert<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">).</span>initialized<span class="Delimiter">);</span> - <span class="Normal">if</span> <span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><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>Primitive_recipe_depth<span class="Delimiter">,</span> <span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"jump-unless fell through"</span> << end<span class="Delimiter">();</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> @@ -159,22 +158,22 @@ Recipe_ordinal[<span class="Constant">"jump-unless"</span>] = JUMP_UNL <span class="Delimiter">:(scenario jump_unless)</span> recipe main [ - jump-unless <span class="Constant">0</span>:literal<span class="Delimiter">,</span> <span class="Constant">1</span>:offset - <span class="Constant">123</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal + jump-unless <span class="Constant">0</span><span class="Delimiter">,</span> <span class="Constant">1</span>:offset + <span class="Constant">123</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span> ] -<span class="traceContains">+run: jump-unless 0:literal, 1:offset</span> +<span class="traceContains">+run: jump-unless 0, 1:offset</span> <span class="traceContains">+run: jumping to instruction 2</span> -<span class="traceAbsent">-run: 123:number <- copy 1:literal</span> +<span class="traceAbsent">-run: 123:number <- copy 1</span> <span class="traceAbsent">-mem: storing 1 in location 123</span> <span class="Delimiter">:(scenario jump_unless_fallthrough)</span> recipe main [ - jump-unless <span class="Constant">999</span>:literal<span class="Delimiter">,</span> <span class="Constant">1</span>:offset - <span class="Constant">123</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span>:literal + jump-unless <span class="Constant">999</span><span class="Delimiter">,</span> <span class="Constant">1</span>:offset + <span class="Constant">123</span>:number<span class="Special"> <- </span>copy <span class="Constant">1</span> ] -<span class="traceContains">+run: jump-unless 999:literal, 1:offset</span> +<span class="traceContains">+run: jump-unless 999, 1:offset</span> <span class="traceContains">+run: jump-unless fell through</span> -<span class="traceContains">+run: 123:number <- copy 1:literal</span> +<span class="traceContains">+run: 123:number <- copy 1</span> <span class="traceContains">+mem: storing 1 in location 123</span> </pre> </body> |