diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-05 11:00:05 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-05 11:00:05 -0700 |
commit | d3a9db3aff54ea485f409eaaef3d8f56ad77f0dc (patch) | |
tree | 60858669ff7c5a5b041e4dacb8ffffa0a4b3e68a /html/apps/factorial.mu.html | |
parent | f13576b5d273ef9175e938b15f55bb1ead22fb1d (diff) | |
download | mu-d3a9db3aff54ea485f409eaaef3d8f56ad77f0dc.tar.gz |
6958
Diffstat (limited to 'html/apps/factorial.mu.html')
-rw-r--r-- | html/apps/factorial.mu.html | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/html/apps/factorial.mu.html b/html/apps/factorial.mu.html index 4880270d..289330dd 100644 --- a/html/apps/factorial.mu.html +++ b/html/apps/factorial.mu.html @@ -14,12 +14,12 @@ pre { white-space: pre-wrap; font-family: monospace; color: #000000; background- body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } -.muTest { color: #5f8700; } +.muComment { color: #005faf; } .LineNr { } -.muFunction { color: #af5f00; text-decoration: underline; } .SpecialChar { color: #d70000; } -.Comment { color: #005faf; } .Constant { color: #008787; } +.muFunction { color: #af5f00; text-decoration: underline; } +.muTest { color: #5f8700; } .Delimiter { color: #c000c0; } .PreProc { color: #c000c0; } --> @@ -57,18 +57,18 @@ if ('onhashchange' in window) { <body onload='JumpToLine();'> <a href='https://github.com/akkartik/mu/blob/master/apps/factorial.mu'>https://github.com/akkartik/mu/blob/master/apps/factorial.mu</a> <pre id='vimCodeElement'> -<span id="L1" class="LineNr"> 1 </span><span class="Comment"># compute the factorial of 5, and return the result in the exit code</span> -<span id="L2" class="LineNr"> 2 </span><span class="Comment">#</span> -<span id="L3" class="LineNr"> 3 </span><span class="Comment"># To run:</span> -<span id="L4" class="LineNr"> 4 </span><span class="Comment"># $ ./translate_mu apps/factorial.mu</span> -<span id="L5" class="LineNr"> 5 </span><span class="Comment"># $ ./a.elf</span> -<span id="L6" class="LineNr"> 6 </span><span class="Comment"># $ echo $?</span> -<span id="L7" class="LineNr"> 7 </span><span class="Comment"># 120</span> -<span id="L8" class="LineNr"> 8 </span><span class="Comment">#</span> -<span id="L9" class="LineNr"> 9 </span><span class="Comment"># You can also run the automated test suite:</span> -<span id="L10" class="LineNr">10 </span><span class="Comment"># $ ./a.elf test</span> -<span id="L11" class="LineNr">11 </span><span class="Comment">#</span> -<span id="L12" class="LineNr">12 </span><span class="Comment"># Compare apps/factorial4.subx</span> +<span id="L1" class="LineNr"> 1 </span><span class="muComment"># compute the factorial of 5, and return the result in the exit code</span> +<span id="L2" class="LineNr"> 2 </span><span class="muComment">#</span> +<span id="L3" class="LineNr"> 3 </span><span class="muComment"># To run:</span> +<span id="L4" class="LineNr"> 4 </span><span class="muComment"># $ ./translate_mu apps/factorial.mu</span> +<span id="L5" class="LineNr"> 5 </span><span class="muComment"># $ ./a.elf</span> +<span id="L6" class="LineNr"> 6 </span><span class="muComment"># $ echo $?</span> +<span id="L7" class="LineNr"> 7 </span><span class="muComment"># 120</span> +<span id="L8" class="LineNr"> 8 </span><span class="muComment">#</span> +<span id="L9" class="LineNr"> 9 </span><span class="muComment"># You can also run the automated test suite:</span> +<span id="L10" class="LineNr">10 </span><span class="muComment"># $ ./a.elf test</span> +<span id="L11" class="LineNr">11 </span><span class="muComment">#</span> +<span id="L12" class="LineNr">12 </span><span class="muComment"># Compare apps/factorial4.subx</span> <span id="L13" class="LineNr">13 </span> <span id="L14" class="LineNr">14 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='factorial.mu.html#L14'>factorial</a></span> n: int<span class="PreProc"> -> </span>result/<span class="Constant">eax</span>: int <span class="Delimiter">{</span> <span id="L15" class="LineNr">15 </span> compare n <span class="Constant">1</span> @@ -94,7 +94,7 @@ if ('onhashchange' in window) { <span id="L35" class="LineNr">35 </span> <span class="PreProc">var</span> args/<span class="Constant">eax</span>: (addr array addr array byte) <span class="SpecialChar"><-</span> copy args-on-stack <span id="L36" class="LineNr">36 </span> <span class="PreProc">var</span> tmp/<span class="Constant">ecx</span>: int <span class="SpecialChar"><-</span> length args <span id="L37" class="LineNr">37 </span> $main-body: <span class="Delimiter">{</span> -<span id="L38" class="LineNr">38 </span> <span class="Comment"># if (len(args) <= 1) factorial(5)</span> +<span id="L38" class="LineNr">38 </span> <span class="muComment"># if (len(args) <= 1) factorial(5)</span> <span id="L39" class="LineNr">39 </span> compare tmp, <span class="Constant">1</span> <span id="L40" class="LineNr">40 </span> <span class="Delimiter">{</span> <span id="L41" class="LineNr">41 </span> <span class="PreProc">break-if-></span> @@ -102,14 +102,14 @@ if ('onhashchange' in window) { <span id="L43" class="LineNr">43 </span> exit-status <span class="SpecialChar"><-</span> copy tmp <span id="L44" class="LineNr">44 </span> <span class="PreProc">break</span> $main-body <span id="L45" class="LineNr">45 </span> <span class="Delimiter">}</span> -<span id="L46" class="LineNr">46 </span> <span class="Comment"># if (args[1] == "test") run-tests()</span> +<span id="L46" class="LineNr">46 </span> <span class="muComment"># if (args[1] == "test") run-tests()</span> <span id="L47" class="LineNr">47 </span> <span class="PreProc">var</span> tmp2/<span class="Constant">ecx</span>: (addr addr array byte) <span class="SpecialChar"><-</span> index args, <span class="Constant">1</span> <span id="L48" class="LineNr">48 </span> <span class="PreProc">var</span> tmp3/<span class="Constant">eax</span>: boolean <span class="SpecialChar"><-</span> <a href='../105string-equal.subx.html#L15'>string-equal?</a> *tmp2, <span class="Constant">"test"</span> <span id="L49" class="LineNr">49 </span> compare tmp3, <span class="Constant">0</span> <span id="L50" class="LineNr">50 </span> <span class="Delimiter">{</span> <span id="L51" class="LineNr">51 </span> <span class="PreProc">break-if-=</span> <span id="L52" class="LineNr">52 </span> run-tests -<span id="L53" class="LineNr">53 </span> exit-status <span class="SpecialChar"><-</span> copy <span class="Constant">0</span> <span class="Comment"># TODO: get at Num-test-failures somehow</span> +<span id="L53" class="LineNr">53 </span> exit-status <span class="SpecialChar"><-</span> copy <span class="Constant">0</span> <span class="muComment"># TODO: get at Num-test-failures somehow</span> <span id="L54" class="LineNr">54 </span> <span class="Delimiter">}</span> <span id="L55" class="LineNr">55 </span> <span class="Delimiter">}</span> <span id="L56" class="LineNr">56 </span><span class="Delimiter">}</span> |