diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-07-16 08:38:43 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-07-16 08:38:43 -0700 |
commit | 78357b8852626b510527f3b8d770a7dd8956fcc7 (patch) | |
tree | 5e38d0f616ab151e66618090487b41dd2fc348e0 /html/shell/macroexpand.mu.html | |
parent | 44d26b77c45668c9b0c99894a4294cec004361fe (diff) | |
download | mu-78357b8852626b510527f3b8d770a7dd8956fcc7.tar.gz |
.
Diffstat (limited to 'html/shell/macroexpand.mu.html')
-rw-r--r-- | html/shell/macroexpand.mu.html | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/html/shell/macroexpand.mu.html b/html/shell/macroexpand.mu.html index d11e5f06..b05077d2 100644 --- a/html/shell/macroexpand.mu.html +++ b/html/shell/macroexpand.mu.html @@ -1,14 +1,14 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<!DOCTYPE html> <html> <head> -<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<meta charset="UTF-8"> <title>Mu - shell/macroexpand.mu</title> -<meta name="Generator" content="Vim/8.1"> -<meta name="plugin-version" content="vim8.1_v1"> +<meta name="Generator" content="Vim/8.2"> +<meta name="plugin-version" content="vim8.1_v2"> <meta name="syntax" content="none"> -<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy="> +<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy=,use_input_for_pc=fallback"> <meta name="colorscheme" content="minimal-light"> -<style type="text/css"> +<style> <!-- pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #ffffd7; } body { font-size:12pt; font-family: monospace; color: #000000; background-color: #ffffd7; } @@ -16,23 +16,23 @@ a { color:inherit; } * { font-size:12pt; font-size: 1em; } .LineNr { } .Delimiter { color: #c000c0; } -.CommentedCode { color: #8a8a8a; } +.muComment { color: #005faf; } +.muRegEcx { color: #870000; } +.muRegEdx { color: #af5f00; } .muRegEbx { color: #5f00ff; } .muRegEsi { color: #005faf; } .muRegEdi { color: #00af00; } .Constant { color: #008787; } .Special { color: #ff6060; } .PreProc { color: #c000c0; } -.Folded { color: #080808; background-color: #949494; } .muFunction { color: #af5f00; text-decoration: underline; } .muTest { color: #5f8700; } -.muComment { color: #005faf; } -.muRegEcx { color: #870000; } -.muRegEdx { color: #af5f00; } +.Folded { color: #080808; background-color: #949494; } +.CommentedCode { color: #8a8a8a; } --> </style> -<script type='text/javascript'> +<script> <!-- /* function to open any folds containing a jumped-to line before jumping to it */ @@ -65,7 +65,7 @@ if ('onhashchange' in window) { <a href='https://github.com/akkartik/mu/blob/main/shell/macroexpand.mu'>https://github.com/akkartik/mu/blob/main/shell/macroexpand.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='macroexpand.mu.html#L1'>macroexpand</a></span> expr-ah: (addr handle <a href='cell.mu.html#L1'>cell</a>), globals: (addr <a href='global.mu.html#L1'>global-table</a>), trace: (addr trace) <span class="Delimiter">{</span> -<span id="L2" class="Folded"> 2 </span><span class="Folded">+-- 15 lines: # trace "macroexpand " expr-ah --------------------------------------------------------------------------------------------------------------------------------------------</span> +<span id="L2" class="Folded"> 2 </span><span class="Folded">+-- 15 lines: # trace "macroexpand " expr-ah -------------------------------------------------------------------------------------------------------------------------------</span> <span id="L17" class="LineNr"> 17 </span> <a href='trace.mu.html#L239'>trace-lower</a> trace <span id="L18" class="LineNr"> 18 </span> <span class="muComment"># loop until convergence</span> <span id="L19" class="LineNr"> 19 </span> <span class="Delimiter">{</span> @@ -77,19 +77,19 @@ if ('onhashchange' in window) { <span id="L25" class="LineNr"> 25 </span> <span class="PreProc">loop-if-!=</span> <span id="L26" class="LineNr"> 26 </span> <span class="Delimiter">}</span> <span id="L27" class="LineNr"> 27 </span> <a href='trace.mu.html#L250'>trace-higher</a> trace -<span id="L28" class="Folded"> 28 </span><span class="Folded">+-- 15 lines: # trace "=> " expr-ah -----------------------------------------------------------------------------------------------------------------------------------------------------</span> +<span id="L28" class="Folded"> 28 </span><span class="Folded">+-- 15 lines: # trace "=> " expr-ah ----------------------------------------------------------------------------------------------------------------------------------------</span> <span id="L43" class="LineNr"> 43 </span><span class="Delimiter">}</span> <span id="L44" class="LineNr"> 44 </span> <span id="L45" class="LineNr"> 45 </span><span class="muComment"># return true if we found any macros</span> <span id="L46" class="LineNr"> 46 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='macroexpand.mu.html#L46'>macroexpand-iter</a></span> _expr-ah: (addr handle <a href='cell.mu.html#L1'>cell</a>), globals: (addr <a href='global.mu.html#L1'>global-table</a>), trace: (addr trace)<span class="PreProc"> -> </span>_/eax: boolean <span class="Delimiter">{</span> <span id="L47" class="LineNr"> 47 </span> <span class="PreProc">var</span> expr-ah/<span class="muRegEsi">esi</span>: (addr handle <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> copy _expr-ah -<span id="L48" class="Folded"> 48 </span><span class="Folded">+-- 15 lines: # trace "macroexpand-iter " expr ------------------------------------------------------------------------------------------------------------------------------------------</span> +<span id="L48" class="Folded"> 48 </span><span class="Folded">+-- 15 lines: # trace "macroexpand-iter " expr -----------------------------------------------------------------------------------------------------------------------------</span> <span id="L63" class="LineNr"> 63 </span> <a href='trace.mu.html#L239'>trace-lower</a> trace <span id="L64" class="LineNr"> 64 </span> <span class="muComment"># if expr is a non-pair, return</span> <span id="L65" class="LineNr"> 65 </span> <span class="PreProc">var</span> expr/eax: (addr <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> <a href='../120allocate.subx.html#L223'>lookup</a> *expr-ah <span id="L66" class="LineNr"> 66 </span> <span class="Delimiter">{</span> -<span id="L67" class="LineNr"> 67 </span> <span class="PreProc">var</span> <a href='print.mu.html#L347'>nil?</a>/eax: boolean <span class="Special"><-</span> <a href='print.mu.html#L347'>nil?</a> expr -<span id="L68" class="LineNr"> 68 </span> compare <a href='print.mu.html#L347'>nil?</a>, <span class="Constant">0</span>/false +<span id="L67" class="LineNr"> 67 </span> <span class="PreProc">var</span> <a href='print.mu.html#L353'>nil?</a>/eax: boolean <span class="Special"><-</span> <a href='print.mu.html#L353'>nil?</a> expr +<span id="L68" class="LineNr"> 68 </span> compare <a href='print.mu.html#L353'>nil?</a>, <span class="Constant">0</span>/false <span id="L69" class="LineNr"> 69 </span> <span class="PreProc">break-if-=</span> <span id="L70" class="LineNr"> 70 </span> <span class="muComment"># nil is a literal</span> <span id="L71" class="LineNr"> 71 </span> <a href='trace.mu.html#L185'>trace-text</a> trace, <span class="Constant">"mac"</span>, <span class="Constant">"nil"</span> @@ -110,8 +110,8 @@ if ('onhashchange' in window) { <span id="L86" class="LineNr"> 86 </span> <span class="PreProc">var</span> rest-ah/<span class="muRegEcx">ecx</span>: (addr handle <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> get expr, right <span id="L87" class="LineNr"> 87 </span> <span class="PreProc">var</span> first/eax: (addr <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> <a href='../120allocate.subx.html#L223'>lookup</a> *first-ah <span id="L88" class="LineNr"> 88 </span> <span class="Delimiter">{</span> -<span id="L89" class="LineNr"> 89 </span> <span class="PreProc">var</span> <a href='evaluate.mu.html#L1429'>litfn?</a>/eax: boolean <span class="Special"><-</span> <a href='evaluate.mu.html#L1429'>litfn?</a> first -<span id="L90" class="LineNr"> 90 </span> compare <a href='evaluate.mu.html#L1429'>litfn?</a>, <span class="Constant">0</span>/false +<span id="L89" class="LineNr"> 89 </span> <span class="PreProc">var</span> <a href='evaluate.mu.html#L1454'>litfn?</a>/eax: boolean <span class="Special"><-</span> <a href='evaluate.mu.html#L1454'>litfn?</a> first +<span id="L90" class="LineNr"> 90 </span> compare <a href='evaluate.mu.html#L1454'>litfn?</a>, <span class="Constant">0</span>/false <span id="L91" class="LineNr"> 91 </span> <span class="PreProc">break-if-=</span> <span id="L92" class="LineNr"> 92 </span> <span class="muComment"># litfn is a literal</span> <span id="L93" class="LineNr"> 93 </span> <a href='trace.mu.html#L185'>trace-text</a> trace, <span class="Constant">"mac"</span>, <span class="Constant">"literal function"</span> @@ -119,8 +119,8 @@ if ('onhashchange' in window) { <span id="L95" class="LineNr"> 95 </span> <span class="PreProc">return</span> <span class="Constant">0</span>/false <span id="L96" class="LineNr"> 96 </span> <span class="Delimiter">}</span> <span id="L97" class="LineNr"> 97 </span> <span class="Delimiter">{</span> -<span id="L98" class="LineNr"> 98 </span> <span class="PreProc">var</span> <a href='evaluate.mu.html#L1443'>litmac?</a>/eax: boolean <span class="Special"><-</span> <a href='evaluate.mu.html#L1443'>litmac?</a> first -<span id="L99" class="LineNr"> 99 </span> compare <a href='evaluate.mu.html#L1443'>litmac?</a>, <span class="Constant">0</span>/false +<span id="L98" class="LineNr"> 98 </span> <span class="PreProc">var</span> <a href='evaluate.mu.html#L1468'>litmac?</a>/eax: boolean <span class="Special"><-</span> <a href='evaluate.mu.html#L1468'>litmac?</a> first +<span id="L99" class="LineNr"> 99 </span> compare <a href='evaluate.mu.html#L1468'>litmac?</a>, <span class="Constant">0</span>/false <span id="L100" class="LineNr">100 </span> <span class="PreProc">break-if-=</span> <span id="L101" class="LineNr">101 </span> <span class="muComment"># litmac is a literal</span> <span id="L102" class="LineNr">102 </span> <a href='trace.mu.html#L185'>trace-text</a> trace, <span class="Constant">"mac"</span>, <span class="Constant">"literal macro"</span> @@ -130,8 +130,8 @@ if ('onhashchange' in window) { <span id="L106" class="LineNr">106 </span> <span class="PreProc">var</span> result/<span class="muRegEdi">edi</span>: boolean <span class="Special"><-</span> copy <span class="Constant">0</span>/false <span id="L107" class="LineNr">107 </span> <span class="muComment"># for each builtin, expand only what will later be evaluated</span> <span id="L108" class="LineNr">108 </span> $macroexpand-iter:anonymous-function: <span class="Delimiter">{</span> -<span id="L109" class="LineNr">109 </span> <span class="PreProc">var</span> <a href='evaluate.mu.html#L1415'>fn?</a>/eax: boolean <span class="Special"><-</span> <a href='evaluate.mu.html#L1415'>fn?</a> first -<span id="L110" class="LineNr">110 </span> compare <a href='evaluate.mu.html#L1415'>fn?</a>, <span class="Constant">0</span>/false +<span id="L109" class="LineNr">109 </span> <span class="PreProc">var</span> <a href='evaluate.mu.html#L1440'>fn?</a>/eax: boolean <span class="Special"><-</span> <a href='evaluate.mu.html#L1440'>fn?</a> first +<span id="L110" class="LineNr">110 </span> compare <a href='evaluate.mu.html#L1440'>fn?</a>, <span class="Constant">0</span>/false <span id="L111" class="LineNr">111 </span> <span class="PreProc">break-if-=</span> <span id="L112" class="LineNr">112 </span> <span class="muComment"># fn: expand every expression in the body</span> <span id="L113" class="LineNr">113 </span> <a href='trace.mu.html#L185'>trace-text</a> trace, <span class="Constant">"mac"</span>, <span class="Constant">"anonymous function"</span> @@ -141,7 +141,7 @@ if ('onhashchange' in window) { <span id="L117" class="LineNr">117 </span> rest-ah <span class="Special"><-</span> get rest, right <span id="L118" class="LineNr">118 </span> rest <span class="Special"><-</span> <a href='../120allocate.subx.html#L223'>lookup</a> *rest-ah <span id="L119" class="LineNr">119 </span> <span class="Delimiter">{</span> -<span id="L120" class="LineNr">120 </span> <span class="PreProc">var</span> done?/eax: boolean <span class="Special"><-</span> <a href='print.mu.html#L347'>nil?</a> rest +<span id="L120" class="LineNr">120 </span> <span class="PreProc">var</span> done?/eax: boolean <span class="Special"><-</span> <a href='print.mu.html#L353'>nil?</a> rest <span id="L121" class="LineNr">121 </span> compare done?, <span class="Constant">0</span>/false <span id="L122" class="LineNr">122 </span> <span class="Delimiter">}</span> <span id="L123" class="LineNr">123 </span> <span class="PreProc">break-if-!=</span> @@ -158,7 +158,7 @@ if ('onhashchange' in window) { <span id="L134" class="LineNr">134 </span> <span class="PreProc">loop</span> <span id="L135" class="LineNr">135 </span> <span class="Delimiter">}</span> <span id="L136" class="LineNr">136 </span> <a href='trace.mu.html#L250'>trace-higher</a> trace -<span id="L137" class="Folded">137 </span><span class="Folded">+-- 15 lines: # trace "fn=> " _expr-ah --------------------------------------------------------------------------------------------------------------------------------------------------</span> +<span id="L137" class="Folded">137 </span><span class="Folded">+-- 15 lines: # trace "fn=> " _expr-ah -------------------------------------------------------------------------------------------------------------------------------------</span> <span id="L152" class="LineNr">152 </span> <span class="PreProc">return</span> result <span id="L153" class="LineNr">153 </span> <span class="Delimiter">}</span> <span id="L154" class="LineNr">154 </span> <span class="muComment"># builtins with "special" evaluation rules</span> @@ -202,7 +202,7 @@ if ('onhashchange' in window) { <span id="L192" class="LineNr">192 </span> <span class="PreProc">var</span> val-ah/<span class="muRegEdx">edx</span>: (addr handle <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> get rest, left <span id="L193" class="LineNr">193 </span> <span class="PreProc">var</span> macro-found?/eax: boolean <span class="Special"><-</span> <a href='macroexpand.mu.html#L46'>macroexpand-iter</a> val-ah, globals, trace <span id="L194" class="LineNr">194 </span> <a href='trace.mu.html#L250'>trace-higher</a> trace -<span id="L195" class="Folded">195 </span><span class="Folded">+-- 15 lines: # trace "define=> " _expr-ah ----------------------------------------------------------------------------------------------------------------------------------------------</span> +<span id="L195" class="Folded">195 </span><span class="Folded">+-- 15 lines: # trace "define=> " _expr-ah ---------------------------------------------------------------------------------------------------------------------------------</span> <span id="L210" class="LineNr">210 </span> <span class="PreProc">return</span> macro-found? <span id="L211" class="LineNr">211 </span> <span class="Delimiter">}</span> <span id="L212" class="LineNr">212 </span> $macroexpand-iter:set: <span class="Delimiter">{</span> @@ -218,7 +218,7 @@ if ('onhashchange' in window) { <span id="L222" class="LineNr">222 </span> <span class="PreProc">var</span> val-ah/<span class="muRegEdx">edx</span>: (addr handle <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> get rest, left <span id="L223" class="LineNr">223 </span> <span class="PreProc">var</span> macro-found?/eax: boolean <span class="Special"><-</span> <a href='macroexpand.mu.html#L46'>macroexpand-iter</a> val-ah, globals, trace <span id="L224" class="LineNr">224 </span> <a href='trace.mu.html#L250'>trace-higher</a> trace -<span id="L225" class="Folded">225 </span><span class="Folded">+-- 15 lines: # trace "set=> " _expr-ah -------------------------------------------------------------------------------------------------------------------------------------------------</span> +<span id="L225" class="Folded">225 </span><span class="Folded">+-- 15 lines: # trace "set=> " _expr-ah ------------------------------------------------------------------------------------------------------------------------------------</span> <span id="L240" class="LineNr">240 </span> <span class="PreProc">return</span> macro-found? <span id="L241" class="LineNr">241 </span> <span class="Delimiter">}</span> <span id="L242" class="LineNr">242 </span> <span class="muComment"># 'and' is like a function for macroexpansion purposes</span> @@ -243,7 +243,7 @@ if ('onhashchange' in window) { <span id="L261" class="LineNr">261 </span> <span class="Delimiter">{</span> <span id="L262" class="LineNr">262 </span> <span class="PreProc">var</span> definition-car-ah/eax: (addr handle <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> get definition, left <span id="L263" class="LineNr">263 </span> <span class="PreProc">var</span> definition-car/eax: (addr <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> <a href='../120allocate.subx.html#L223'>lookup</a> *definition-car-ah -<span id="L264" class="LineNr">264 </span> <span class="PreProc">var</span> macro?/eax: boolean <span class="Special"><-</span> <a href='evaluate.mu.html#L1443'>litmac?</a> definition-car +<span id="L264" class="LineNr">264 </span> <span class="PreProc">var</span> macro?/eax: boolean <span class="Special"><-</span> <a href='evaluate.mu.html#L1468'>litmac?</a> definition-car <span id="L265" class="LineNr">265 </span> compare macro?, <span class="Constant">0</span>/false <span id="L266" class="LineNr">266 </span> <span class="Delimiter">}</span> <span id="L267" class="LineNr">267 </span> <span class="PreProc">break-if-=</span> @@ -253,7 +253,7 @@ if ('onhashchange' in window) { <span id="L271" class="LineNr">271 </span><span class="CommentedCode">#? turn-on-debug-print</span> <span id="L272" class="LineNr">272 </span> <a href='evaluate.mu.html#L655'>apply</a> macro-definition-ah, rest-ah, expr-ah, globals, trace, <span class="Constant">0</span>/no-screen, <span class="Constant">0</span>/no-keyboard, <span class="Constant">0</span>/definitions-created, <span class="Constant">0</span>/call-number <span id="L273" class="LineNr">273 </span> <a href='trace.mu.html#L250'>trace-higher</a> trace -<span id="L274" class="Folded">274 </span><span class="Folded">+-- 15 lines: # trace "1=> " _expr-ah ---------------------------------------------------------------------------------------------------------------------------------------------------</span> +<span id="L274" class="Folded">274 </span><span class="Folded">+-- 15 lines: # trace "1=> " _expr-ah --------------------------------------------------------------------------------------------------------------------------------------</span> <span id="L289" class="LineNr">289 </span> <span class="PreProc">return</span> <span class="Constant">1</span>/true <span id="L290" class="LineNr">290 </span> <span class="Delimiter">}</span> <span id="L291" class="LineNr">291 </span> <span class="muComment"># no macro found; process any macros within args</span> @@ -269,8 +269,8 @@ if ('onhashchange' in window) { <span id="L301" class="LineNr">301 </span> <span class="PreProc">break-if-!=</span> <span id="L302" class="LineNr">302 </span> <span class="PreProc">var</span> rest/eax: (addr <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> <a href='../120allocate.subx.html#L223'>lookup</a> *rest-ah <span id="L303" class="LineNr">303 </span> <span class="Delimiter">{</span> -<span id="L304" class="LineNr">304 </span> <span class="PreProc">var</span> <a href='print.mu.html#L347'>nil?</a>/eax: boolean <span class="Special"><-</span> <a href='print.mu.html#L347'>nil?</a> rest -<span id="L305" class="LineNr">305 </span> compare <a href='print.mu.html#L347'>nil?</a>, <span class="Constant">0</span>/false +<span id="L304" class="LineNr">304 </span> <span class="PreProc">var</span> <a href='print.mu.html#L353'>nil?</a>/eax: boolean <span class="Special"><-</span> <a href='print.mu.html#L353'>nil?</a> rest +<span id="L305" class="LineNr">305 </span> compare <a href='print.mu.html#L353'>nil?</a>, <span class="Constant">0</span>/false <span id="L306" class="LineNr">306 </span> <span class="Delimiter">}</span> <span id="L307" class="LineNr">307 </span> <span class="PreProc">break-if-!=</span> <span id="L308" class="LineNr">308 </span> curr-ah <span class="Special"><-</span> get rest, left @@ -278,7 +278,7 @@ if ('onhashchange' in window) { <span id="L310" class="LineNr">310 </span> <span class="PreProc">loop</span> <span id="L311" class="LineNr">311 </span> <span class="Delimiter">}</span> <span id="L312" class="LineNr">312 </span> <a href='trace.mu.html#L250'>trace-higher</a> trace -<span id="L313" class="Folded">313 </span><span class="Folded">+-- 15 lines: # trace "=> " _expr-ah ----------------------------------------------------------------------------------------------------------------------------------------------------</span> +<span id="L313" class="Folded">313 </span><span class="Folded">+-- 15 lines: # trace "=> " _expr-ah ---------------------------------------------------------------------------------------------------------------------------------------</span> <span id="L328" class="LineNr">328 </span> <span class="PreProc">return</span> result <span id="L329" class="LineNr">329 </span><span class="Delimiter">}</span> <span id="L330" class="LineNr">330 </span> @@ -287,8 +287,8 @@ if ('onhashchange' in window) { <span id="L333" class="LineNr">333 </span> <span class="PreProc">var</span> expr-ah/eax: (addr handle <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> copy _expr-ah <span id="L334" class="LineNr">334 </span> <span class="PreProc">var</span> expr/eax: (addr <a href='cell.mu.html#L1'>cell</a>) <span class="Special"><-</span> <a href='../120allocate.subx.html#L223'>lookup</a> *expr-ah <span id="L335" class="LineNr">335 </span> <span class="Delimiter">{</span> -<span id="L336" class="LineNr">336 </span> <span class="PreProc">var</span> <a href='print.mu.html#L347'>nil?</a>/eax: boolean <span class="Special"><-</span> <a href='print.mu.html#L347'>nil?</a> expr -<span id="L337" class="LineNr">337 </span> compare <a href='print.mu.html#L347'>nil?</a>, <span class="Constant">0</span>/false +<span id="L336" class="LineNr">336 </span> <span class="PreProc">var</span> <a href='print.mu.html#L353'>nil?</a>/eax: boolean <span class="Special"><-</span> <a href='print.mu.html#L353'>nil?</a> expr +<span id="L337" class="LineNr">337 </span> compare <a href='print.mu.html#L353'>nil?</a>, <span class="Constant">0</span>/false <span id="L338" class="LineNr">338 </span> <span class="PreProc">break-if-=</span> <span id="L339" class="LineNr">339 </span> <span class="PreProc">return</span> <span class="Constant">0</span>/false <span id="L340" class="LineNr">340 </span> <span class="Delimiter">}</span> |