about summary refs log tree commit diff stats
path: root/html/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-01-02 15:23:01 -0800
committerKartik Agaram <vc@akkartik.com>2020-01-02 15:23:01 -0800
commitc9bda4d13ea33873dd5bce1eef0434cb11763d19 (patch)
tree6a4488fc7c7dd3408687ecd03b94cac97a606f0a /html/apps
parent6f1581e77b8587da86a2fdaa461f83ab464447ce (diff)
downloadmu-c9bda4d13ea33873dd5bce1eef0434cb11763d19.tar.gz
5875
Diffstat (limited to 'html/apps')
-rw-r--r--html/apps/ex1.mu.html73
-rw-r--r--html/apps/ex1.subx.html6
-rw-r--r--html/apps/ex10.subx.html4
-rw-r--r--html/apps/ex11.subx.html48
-rw-r--r--html/apps/ex12.subx.html4
-rw-r--r--html/apps/ex2.mu.html78
-rw-r--r--html/apps/ex2.subx.html4
-rw-r--r--html/apps/ex3.subx.html4
-rw-r--r--html/apps/ex4.subx.html4
-rw-r--r--html/apps/ex5.subx.html4
-rw-r--r--html/apps/ex6.subx.html4
-rw-r--r--html/apps/ex7.subx.html4
-rw-r--r--html/apps/ex8.subx.html4
-rw-r--r--html/apps/ex9.subx.html4
14 files changed, 198 insertions, 47 deletions
diff --git a/html/apps/ex1.mu.html b/html/apps/ex1.mu.html
new file mode 100644
index 00000000..a404b378
--- /dev/null
+++ b/html/apps/ex1.mu.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<title>Mu - apps/ex1.mu</title>
+<meta name="Generator" content="Vim/8.1">
+<meta name="plugin-version" content="vim8.1_v1">
+<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="colorscheme" content="minimal-light">
+<style type="text/css">
+<!--
+pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #c6c6c6; }
+body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; }
+a { color:inherit; }
+* { font-size:12pt; font-size: 1em; }
+.LineNr { }
+.Comment { color: #005faf; }
+.Delimiter { color: #c000c0; }
+.Special { color: #ff6060; }
+.PreProc { color: #c000c0; }
+-->
+</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+  var lineNum;
+  lineNum = window.location.hash;
+  lineNum = lineNum.substr(1); /* strip off '#' */
+
+  if (lineNum.indexOf('L') == -1) {
+    lineNum = 'L'+lineNum;
+  }
+  var lineElem = document.getElementById(lineNum);
+  /* Always jump to new location even if the line was hidden inside a fold, or
+   * we corrected the raw number to a line ID.
+   */
+  if (lineElem) {
+    lineElem.scrollIntoView(true);
+  }
+  return true;
+}
+if ('onhashchange' in window) {
+  window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
+</head>
+<body onload='JumpToLine();'>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex1.mu'>https://github.com/akkartik/mu/blob/master/apps/ex1.mu</a>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="Comment"># First example: return the answer to the Ultimate Question of Life, the</span>
+<span id="L2" class="LineNr"> 2 </span><span class="Comment"># Universe, and Everything.</span>
+<span id="L3" class="LineNr"> 3 </span><span class="Comment">#</span>
+<span id="L4" class="LineNr"> 4 </span><span class="Comment"># To run:</span>
+<span id="L5" class="LineNr"> 5 </span><span class="Comment">#   $ ./translate_mu apps/ex1.mu</span>
+<span id="L6" class="LineNr"> 6 </span><span class="Comment">#   $ ./a.elf</span>
+<span id="L7" class="LineNr"> 7 </span><span class="Comment"># Expected result:</span>
+<span id="L8" class="LineNr"> 8 </span><span class="Comment">#   $ echo $?</span>
+<span id="L9" class="LineNr"> 9 </span><span class="Comment">#   42</span>
+<span id="L10" class="LineNr">10 </span>
+<span id="L11" class="LineNr">11 </span><span class="PreProc">fn</span> <a href='../mu-init-test.subx.html#L7'>main</a><span class="PreProc"> -&gt; </span>result/ebx: int <span class="Delimiter">{</span>
+<span id="L12" class="LineNr">12 </span>  result <span class="Special">&lt;-</span> copy 0x2a  <span class="Comment"># Mu requires hexadecimal</span>
+<span id="L13" class="LineNr">13 </span><span class="Delimiter">}</span>
+</pre>
+</body>
+</html>
+<!-- vim: set foldmethod=manual : -->
diff --git a/html/apps/ex1.subx.html b/html/apps/ex1.subx.html
index c4105769..4cc9e90f 100644
--- a/html/apps/ex1.subx.html
+++ b/html/apps/ex1.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex1.subx</title>
+<title>Mu - apps/ex1.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -51,7 +51,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex1.subx'>https://github.com/akkartik/mu/blob/master/examples/ex1.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex1.subx'>https://github.com/akkartik/mu/blob/master/apps/ex1.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># First program: same as <a href="https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html">https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html</a></span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment"># Just return 42.</span>
@@ -67,7 +67,7 @@ if ('onhashchange' in window) {
 <span id="L12" class="LineNr">12 </span>
 <span id="L13" class="LineNr">13 </span><span class="SpecialChar">Entry</span>:
 <span id="L14" class="LineNr">14 </span><span class="subxComment"># exit(42)</span>
-<span id="L15" class="LineNr">15 </span>bb/copy-to-ebx  2a/imm32  <span class="subxComment"># 42 in hex</span>
+<span id="L15" class="LineNr">15 </span>bb/copy-to-ebx  0x2a/imm32  <span class="subxComment"># 42 in hex</span>
 <span id="L16" class="LineNr">16 </span>e8/call  syscall_exit/disp32
 <span id="L17" class="LineNr">17 </span>
 <span id="L18" class="LineNr">18 </span><span class="subxS2Comment"># . . vim&#0058;nowrap:textwidth=0</span>
diff --git a/html/apps/ex10.subx.html b/html/apps/ex10.subx.html
index bcf0e466..2671b311 100644
--- a/html/apps/ex10.subx.html
+++ b/html/apps/ex10.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex10.subx</title>
+<title>Mu - apps/ex10.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -55,7 +55,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex10.subx'>https://github.com/akkartik/mu/blob/master/examples/ex10.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex10.subx'>https://github.com/akkartik/mu/blob/master/apps/ex10.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># String comparison: return 1 iff the two args passed in at the commandline are equal.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
diff --git a/html/apps/ex11.subx.html b/html/apps/ex11.subx.html
index 47c0b289..28fa18f0 100644
--- a/html/apps/ex11.subx.html
+++ b/html/apps/ex11.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex11.subx</title>
+<title>Mu - apps/ex11.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -58,7 +58,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex11.subx'>https://github.com/akkartik/mu/blob/master/examples/ex11.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex11.subx'>https://github.com/akkartik/mu/blob/master/apps/ex11.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr">  1 </span><span class="subxComment"># Null-terminated vs length-prefixed ascii strings.</span>
 <span id="L2" class="LineNr">  2 </span><span class="subxComment">#</span>
@@ -181,9 +181,9 @@ if ('onhashchange' in window) {
 <span id="L119" class="LineNr">119 </span>    <span class="subxComment"># eax = kernel-string-equal?(Null-kernel-string, &quot;&quot;)</span>
 <span id="L120" class="LineNr">120 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L121" class="LineNr">121 </span>    68/push  <span class="Constant">&quot;&quot;</span>/imm32
-<span id="L122" class="LineNr">122 </span>    68/push  <span class="SpecialChar"><a href='ex11.subx.html#L349'>Null-kernel-string</a></span>/imm32
+<span id="L122" class="LineNr">122 </span>    68/push  <span class="SpecialChar">Null-kernel-string</span>/imm32
 <span id="L123" class="LineNr">123 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L124" class="LineNr">124 </span>    e8/call  <a href='ex11.subx.html#L30'>kernel-string-equal?</a>/disp32
+<span id="L124" class="LineNr">124 </span>    e8/call  kernel-string-equal?/disp32
 <span id="L125" class="LineNr">125 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L126" class="LineNr">126 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
 <span id="L127" class="LineNr">127 </span>    <span class="subxComment"># check-ints-equal(eax, 1, msg)</span>
@@ -192,7 +192,7 @@ if ('onhashchange' in window) {
 <span id="L130" class="LineNr">130 </span>    68/push  1/imm32/true
 <span id="L131" class="LineNr">131 </span>    50/push-eax
 <span id="L132" class="LineNr">132 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L133" class="LineNr">133 </span>    e8/call  <a href='ex11.subx.html#L261'>check-ints-equal</a>/disp32
+<span id="L133" class="LineNr">133 </span>    e8/call  check-ints-equal/disp32
 <span id="L134" class="LineNr">134 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L135" class="LineNr">135 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              0xc/imm32         <span class="subxComment"># add to esp</span>
 <span id="L136" class="LineNr">136 </span>    c3/return
@@ -201,9 +201,9 @@ if ('onhashchange' in window) {
 <span id="L139" class="LineNr">139 </span>    <span class="subxComment"># eax = kernel-string-equal?(Null-kernel-string, &quot;Abc&quot;)</span>
 <span id="L140" class="LineNr">140 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L141" class="LineNr">141 </span>    68/push  <span class="Constant">&quot;Abc&quot;</span>/imm32
-<span id="L142" class="LineNr">142 </span>    68/push  <span class="SpecialChar"><a href='ex11.subx.html#L349'>Null-kernel-string</a></span>/imm32
+<span id="L142" class="LineNr">142 </span>    68/push  <span class="SpecialChar">Null-kernel-string</span>/imm32
 <span id="L143" class="LineNr">143 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L144" class="LineNr">144 </span>    e8/call  <a href='ex11.subx.html#L30'>kernel-string-equal?</a>/disp32
+<span id="L144" class="LineNr">144 </span>    e8/call  kernel-string-equal?/disp32
 <span id="L145" class="LineNr">145 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L146" class="LineNr">146 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
 <span id="L147" class="LineNr">147 </span>    <span class="subxComment"># check-ints-equal(eax, 0, msg)</span>
@@ -212,7 +212,7 @@ if ('onhashchange' in window) {
 <span id="L150" class="LineNr">150 </span>    68/push  0/imm32/false
 <span id="L151" class="LineNr">151 </span>    50/push-eax
 <span id="L152" class="LineNr">152 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L153" class="LineNr">153 </span>    e8/call  <a href='ex11.subx.html#L261'>check-ints-equal</a>/disp32
+<span id="L153" class="LineNr">153 </span>    e8/call  check-ints-equal/disp32
 <span id="L154" class="LineNr">154 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L155" class="LineNr">155 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              0xc/imm32         <span class="subxComment"># add to esp</span>
 <span id="L156" class="LineNr">156 </span>    c3/return
@@ -221,9 +221,9 @@ if ('onhashchange' in window) {
 <span id="L159" class="LineNr">159 </span>    <span class="subxComment"># eax = kernel-string-equal?(_test-Abc-kernel-string, &quot;Abc&quot;)</span>
 <span id="L160" class="LineNr">160 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L161" class="LineNr">161 </span>    68/push  <span class="Constant">&quot;Abc&quot;</span>/imm32
-<span id="L162" class="LineNr">162 </span>    68/push  <a href='ex11.subx.html#L352'>_test-Abc-kernel-string</a>/imm32
+<span id="L162" class="LineNr">162 </span>    68/push  _test-Abc-kernel-string/imm32
 <span id="L163" class="LineNr">163 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L164" class="LineNr">164 </span>    e8/call  <a href='ex11.subx.html#L30'>kernel-string-equal?</a>/disp32
+<span id="L164" class="LineNr">164 </span>    e8/call  kernel-string-equal?/disp32
 <span id="L165" class="LineNr">165 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L166" class="LineNr">166 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
 <span id="L167" class="LineNr">167 </span>    <span class="subxComment"># check-ints-equal(eax, 1, msg)</span>
@@ -232,7 +232,7 @@ if ('onhashchange' in window) {
 <span id="L170" class="LineNr">170 </span>    68/push  1/imm32/true
 <span id="L171" class="LineNr">171 </span>    50/push-eax
 <span id="L172" class="LineNr">172 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L173" class="LineNr">173 </span>    e8/call  <a href='ex11.subx.html#L261'>check-ints-equal</a>/disp32
+<span id="L173" class="LineNr">173 </span>    e8/call  check-ints-equal/disp32
 <span id="L174" class="LineNr">174 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L175" class="LineNr">175 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              0xc/imm32         <span class="subxComment"># add to esp</span>
 <span id="L176" class="LineNr">176 </span>    c3/return
@@ -241,9 +241,9 @@ if ('onhashchange' in window) {
 <span id="L179" class="LineNr">179 </span>    <span class="subxComment"># eax = kernel-string-equal?(_test-Abc-kernel-string, &quot;Adc&quot;)</span>
 <span id="L180" class="LineNr">180 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L181" class="LineNr">181 </span>    68/push  <span class="Constant">&quot;Adc&quot;</span>/imm32
-<span id="L182" class="LineNr">182 </span>    68/push  <a href='ex11.subx.html#L352'>_test-Abc-kernel-string</a>/imm32
+<span id="L182" class="LineNr">182 </span>    68/push  _test-Abc-kernel-string/imm32
 <span id="L183" class="LineNr">183 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L184" class="LineNr">184 </span>    e8/call  <a href='ex11.subx.html#L30'>kernel-string-equal?</a>/disp32
+<span id="L184" class="LineNr">184 </span>    e8/call  kernel-string-equal?/disp32
 <span id="L185" class="LineNr">185 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L186" class="LineNr">186 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
 <span id="L187" class="LineNr">187 </span>    <span class="subxComment"># check-ints-equal(eax, 0, msg)</span>
@@ -252,7 +252,7 @@ if ('onhashchange' in window) {
 <span id="L190" class="LineNr">190 </span>    68/push  0/imm32/false
 <span id="L191" class="LineNr">191 </span>    50/push-eax
 <span id="L192" class="LineNr">192 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L193" class="LineNr">193 </span>    e8/call  <a href='ex11.subx.html#L261'>check-ints-equal</a>/disp32
+<span id="L193" class="LineNr">193 </span>    e8/call  check-ints-equal/disp32
 <span id="L194" class="LineNr">194 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L195" class="LineNr">195 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              0xc/imm32         <span class="subxComment"># add to esp</span>
 <span id="L196" class="LineNr">196 </span>    c3/return
@@ -261,9 +261,9 @@ if ('onhashchange' in window) {
 <span id="L199" class="LineNr">199 </span>    <span class="subxComment"># eax = kernel-string-equal?(_test-Abc-kernel-string, &quot;&quot;)</span>
 <span id="L200" class="LineNr">200 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L201" class="LineNr">201 </span>    68/push  <span class="Constant">&quot;&quot;</span>/imm32
-<span id="L202" class="LineNr">202 </span>    68/push  <a href='ex11.subx.html#L352'>_test-Abc-kernel-string</a>/imm32
+<span id="L202" class="LineNr">202 </span>    68/push  _test-Abc-kernel-string/imm32
 <span id="L203" class="LineNr">203 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L204" class="LineNr">204 </span>    e8/call  <a href='ex11.subx.html#L30'>kernel-string-equal?</a>/disp32
+<span id="L204" class="LineNr">204 </span>    e8/call  kernel-string-equal?/disp32
 <span id="L205" class="LineNr">205 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L206" class="LineNr">206 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
 <span id="L207" class="LineNr">207 </span>    <span class="subxComment"># check-ints-equal(eax, 0, msg)</span>
@@ -272,7 +272,7 @@ if ('onhashchange' in window) {
 <span id="L210" class="LineNr">210 </span>    68/push  0/imm32/false
 <span id="L211" class="LineNr">211 </span>    50/push-eax
 <span id="L212" class="LineNr">212 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L213" class="LineNr">213 </span>    e8/call  <a href='ex11.subx.html#L261'>check-ints-equal</a>/disp32
+<span id="L213" class="LineNr">213 </span>    e8/call  check-ints-equal/disp32
 <span id="L214" class="LineNr">214 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L215" class="LineNr">215 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              0xc/imm32         <span class="subxComment"># add to esp</span>
 <span id="L216" class="LineNr">216 </span>    c3/return
@@ -281,9 +281,9 @@ if ('onhashchange' in window) {
 <span id="L219" class="LineNr">219 </span>    <span class="subxComment"># eax = kernel-string-equal?(_test-Abc-kernel-string, &quot;Ab&quot;)</span>
 <span id="L220" class="LineNr">220 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L221" class="LineNr">221 </span>    68/push  <span class="Constant">&quot;Ab&quot;</span>/imm32
-<span id="L222" class="LineNr">222 </span>    68/push  <a href='ex11.subx.html#L352'>_test-Abc-kernel-string</a>/imm32
+<span id="L222" class="LineNr">222 </span>    68/push  _test-Abc-kernel-string/imm32
 <span id="L223" class="LineNr">223 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L224" class="LineNr">224 </span>    e8/call  <a href='ex11.subx.html#L30'>kernel-string-equal?</a>/disp32
+<span id="L224" class="LineNr">224 </span>    e8/call  kernel-string-equal?/disp32
 <span id="L225" class="LineNr">225 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L226" class="LineNr">226 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
 <span id="L227" class="LineNr">227 </span>    <span class="subxComment"># check-ints-equal(eax, 0, msg)</span>
@@ -292,7 +292,7 @@ if ('onhashchange' in window) {
 <span id="L230" class="LineNr">230 </span>    68/push  0/imm32/false
 <span id="L231" class="LineNr">231 </span>    50/push-eax
 <span id="L232" class="LineNr">232 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L233" class="LineNr">233 </span>    e8/call  <a href='ex11.subx.html#L261'>check-ints-equal</a>/disp32
+<span id="L233" class="LineNr">233 </span>    e8/call  check-ints-equal/disp32
 <span id="L234" class="LineNr">234 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L235" class="LineNr">235 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              0xc/imm32         <span class="subxComment"># add to esp</span>
 <span id="L236" class="LineNr">236 </span>    c3/return
@@ -301,9 +301,9 @@ if ('onhashchange' in window) {
 <span id="L239" class="LineNr">239 </span>    <span class="subxComment"># eax = kernel-string-equal?(_test-Abc-kernel-string, &quot;Abcd&quot;)</span>
 <span id="L240" class="LineNr">240 </span>    <span class="subxS2Comment"># . . push args</span>
 <span id="L241" class="LineNr">241 </span>    68/push  <span class="Constant">&quot;Abcd&quot;</span>/imm32
-<span id="L242" class="LineNr">242 </span>    68/push  <a href='ex11.subx.html#L352'>_test-Abc-kernel-string</a>/imm32
+<span id="L242" class="LineNr">242 </span>    68/push  _test-Abc-kernel-string/imm32
 <span id="L243" class="LineNr">243 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L244" class="LineNr">244 </span>    e8/call  <a href='ex11.subx.html#L30'>kernel-string-equal?</a>/disp32
+<span id="L244" class="LineNr">244 </span>    e8/call  kernel-string-equal?/disp32
 <span id="L245" class="LineNr">245 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L246" class="LineNr">246 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
 <span id="L247" class="LineNr">247 </span>    <span class="subxComment"># check-ints-equal(eax, 0, msg)</span>
@@ -312,7 +312,7 @@ if ('onhashchange' in window) {
 <span id="L250" class="LineNr">250 </span>    68/push  0/imm32/false
 <span id="L251" class="LineNr">251 </span>    50/push-eax
 <span id="L252" class="LineNr">252 </span>    <span class="subxS2Comment"># . . call</span>
-<span id="L253" class="LineNr">253 </span>    e8/call  <a href='ex11.subx.html#L261'>check-ints-equal</a>/disp32
+<span id="L253" class="LineNr">253 </span>    e8/call  check-ints-equal/disp32
 <span id="L254" class="LineNr">254 </span>    <span class="subxS2Comment"># . . discard args</span>
 <span id="L255" class="LineNr">255 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              0xc/imm32         <span class="subxComment"># add to esp</span>
 <span id="L256" class="LineNr">256 </span>    c3/return
@@ -355,7 +355,7 @@ if ('onhashchange' in window) {
 <span id="L293" class="LineNr">293 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              4/imm32           <span class="subxComment"># add to esp</span>
 <span id="L294" class="LineNr">294 </span>    <span class="subxComment"># print newline</span>
 <span id="L295" class="LineNr">295 </span>    <span class="subxS2Comment"># . . push args</span>
-<span id="L296" class="LineNr">296 </span>    68/push  <span class="SpecialChar"><a href='ex11.subx.html#L342'>Newline</a></span>/imm32
+<span id="L296" class="LineNr">296 </span>    68/push  <span class="SpecialChar">Newline</span>/imm32
 <span id="L297" class="LineNr">297 </span>    <span class="subxS2Comment"># . . call</span>
 <span id="L298" class="LineNr">298 </span>    e8/call  <a href='ex11.subx.html#L310'>write-stderr</a>/disp32
 <span id="L299" class="LineNr">299 </span>    <span class="subxS2Comment"># . . discard args</span>
diff --git a/html/apps/ex12.subx.html b/html/apps/ex12.subx.html
index a6b2dc64..221bec80 100644
--- a/html/apps/ex12.subx.html
+++ b/html/apps/ex12.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex12.subx</title>
+<title>Mu - apps/ex12.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -53,7 +53,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex12.subx'>https://github.com/akkartik/mu/blob/master/examples/ex12.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex12.subx'>https://github.com/akkartik/mu/blob/master/apps/ex12.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Example showing mmap syscall.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment"># Create a new segment using mmap, save the address, write to it.</span>
diff --git a/html/apps/ex2.mu.html b/html/apps/ex2.mu.html
new file mode 100644
index 00000000..94429de0
--- /dev/null
+++ b/html/apps/ex2.mu.html
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<title>Mu - apps/ex2.mu</title>
+<meta name="Generator" content="Vim/8.1">
+<meta name="plugin-version" content="vim8.1_v1">
+<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="colorscheme" content="minimal-light">
+<style type="text/css">
+<!--
+pre { white-space: pre-wrap; font-family: monospace; color: #000000; background-color: #c6c6c6; }
+body { font-size:12pt; font-family: monospace; color: #000000; background-color: #c6c6c6; }
+a { color:inherit; }
+* { font-size:12pt; font-size: 1em; }
+.LineNr { }
+.Comment { color: #005faf; }
+.Delimiter { color: #c000c0; }
+.Special { color: #ff6060; }
+.Constant { color: #008787; }
+.PreProc { color: #c000c0; }
+-->
+</style>
+
+<script type='text/javascript'>
+<!--
+
+/* function to open any folds containing a jumped-to line before jumping to it */
+function JumpToLine()
+{
+  var lineNum;
+  lineNum = window.location.hash;
+  lineNum = lineNum.substr(1); /* strip off '#' */
+
+  if (lineNum.indexOf('L') == -1) {
+    lineNum = 'L'+lineNum;
+  }
+  var lineElem = document.getElementById(lineNum);
+  /* Always jump to new location even if the line was hidden inside a fold, or
+   * we corrected the raw number to a line ID.
+   */
+  if (lineElem) {
+    lineElem.scrollIntoView(true);
+  }
+  return true;
+}
+if ('onhashchange' in window) {
+  window.onhashchange = JumpToLine;
+}
+
+-->
+</script>
+</head>
+<body onload='JumpToLine();'>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex2.mu'>https://github.com/akkartik/mu/blob/master/apps/ex2.mu</a>
+<pre id='vimCodeElement'>
+<span id="L1" class="LineNr"> 1 </span><span class="Comment"># Add two numbers, 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/ex2.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"># Expected result:</span>
+<span id="L7" class="LineNr"> 7 </span><span class="Comment">#   $ echo $?</span>
+<span id="L8" class="LineNr"> 8 </span><span class="Comment">#   7</span>
+<span id="L9" class="LineNr"> 9 </span>
+<span id="L10" class="LineNr">10 </span><span class="PreProc">fn</span> <a href='../mu-init-test.subx.html#L7'>main</a><span class="PreProc"> -&gt; </span>result/ebx: int <span class="Delimiter">{</span>
+<span id="L11" class="LineNr">11 </span>  result <span class="Special">&lt;-</span> do-add<span class="Constant"> 3 4</span>
+<span id="L12" class="LineNr">12 </span><span class="Delimiter">}</span>
+<span id="L13" class="LineNr">13 </span>
+<span id="L14" class="LineNr">14 </span><span class="PreProc">fn</span> do-add a: int, b: int<span class="PreProc"> -&gt; </span>result/ebx: int <span class="Delimiter">{</span>
+<span id="L15" class="LineNr">15 </span>  result <span class="Special">&lt;-</span> copy a
+<span id="L16" class="LineNr">16 </span>  result <span class="Special">&lt;-</span> add b
+<span id="L17" class="LineNr">17 </span><span class="Delimiter">}</span>
+</pre>
+</body>
+</html>
+<!-- vim: set foldmethod=manual : -->
diff --git a/html/apps/ex2.subx.html b/html/apps/ex2.subx.html
index c67315e9..f1e4abe9 100644
--- a/html/apps/ex2.subx.html
+++ b/html/apps/ex2.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex2.subx</title>
+<title>Mu - apps/ex2.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -51,7 +51,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex2.subx'>https://github.com/akkartik/mu/blob/master/examples/ex2.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex2.subx'>https://github.com/akkartik/mu/blob/master/apps/ex2.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Add 1 and 1, and return the result in the exit code.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
diff --git a/html/apps/ex3.subx.html b/html/apps/ex3.subx.html
index 7c3da099..e5eece81 100644
--- a/html/apps/ex3.subx.html
+++ b/html/apps/ex3.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex3.subx</title>
+<title>Mu - apps/ex3.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -54,7 +54,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex3.subx'>https://github.com/akkartik/mu/blob/master/examples/ex3.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex3.subx'>https://github.com/akkartik/mu/blob/master/apps/ex3.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Add the first 10 numbers, and return the result in the exit code.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
diff --git a/html/apps/ex4.subx.html b/html/apps/ex4.subx.html
index 43f5c705..b1e1019b 100644
--- a/html/apps/ex4.subx.html
+++ b/html/apps/ex4.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex4.subx</title>
+<title>Mu - apps/ex4.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -52,7 +52,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex4.subx'>https://github.com/akkartik/mu/blob/master/examples/ex4.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex4.subx'>https://github.com/akkartik/mu/blob/master/apps/ex4.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Read a character from stdin, save it to a global, write it to stdout.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
diff --git a/html/apps/ex5.subx.html b/html/apps/ex5.subx.html
index f5112fa7..26c5700b 100644
--- a/html/apps/ex5.subx.html
+++ b/html/apps/ex5.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex5.subx</title>
+<title>Mu - apps/ex5.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -53,7 +53,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex5.subx'>https://github.com/akkartik/mu/blob/master/examples/ex5.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex5.subx'>https://github.com/akkartik/mu/blob/master/apps/ex5.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Read a character from stdin, save it to a local on the stack, write it to stdout.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
diff --git a/html/apps/ex6.subx.html b/html/apps/ex6.subx.html
index c8bbdd21..e8f7dbe4 100644
--- a/html/apps/ex6.subx.html
+++ b/html/apps/ex6.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex6.subx</title>
+<title>Mu - apps/ex6.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -53,7 +53,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex6.subx'>https://github.com/akkartik/mu/blob/master/examples/ex6.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex6.subx'>https://github.com/akkartik/mu/blob/master/apps/ex6.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Print out a (global variable) string to stdout.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
diff --git a/html/apps/ex7.subx.html b/html/apps/ex7.subx.html
index 762bf7ec..617c44c2 100644
--- a/html/apps/ex7.subx.html
+++ b/html/apps/ex7.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex7.subx</title>
+<title>Mu - apps/ex7.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -53,7 +53,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex7.subx'>https://github.com/akkartik/mu/blob/master/examples/ex7.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex7.subx'>https://github.com/akkartik/mu/blob/master/apps/ex7.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Example showing file syscalls.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
diff --git a/html/apps/ex8.subx.html b/html/apps/ex8.subx.html
index 1f57fcdf..ab67bb1f 100644
--- a/html/apps/ex8.subx.html
+++ b/html/apps/ex8.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex8.subx</title>
+<title>Mu - apps/ex8.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -55,7 +55,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex8.subx'>https://github.com/akkartik/mu/blob/master/examples/ex8.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex8.subx'>https://github.com/akkartik/mu/blob/master/apps/ex8.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Example reading commandline arguments: compute length of first arg.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
diff --git a/html/apps/ex9.subx.html b/html/apps/ex9.subx.html
index fbf7b76c..bddb6ff0 100644
--- a/html/apps/ex9.subx.html
+++ b/html/apps/ex9.subx.html
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>Mu - examples/ex9.subx</title>
+<title>Mu - apps/ex9.subx</title>
 <meta name="Generator" content="Vim/8.1">
 <meta name="plugin-version" content="vim8.1_v1">
 <meta name="syntax" content="none">
@@ -54,7 +54,7 @@ if ('onhashchange' in window) {
 </script>
 </head>
 <body onload='JumpToLine();'>
-<a href='https://github.com/akkartik/mu/blob/master/examples/ex9.subx'>https://github.com/akkartik/mu/blob/master/examples/ex9.subx</a>
+<a href='https://github.com/akkartik/mu/blob/master/apps/ex9.subx'>https://github.com/akkartik/mu/blob/master/apps/ex9.subx</a>
 <pre id='vimCodeElement'>
 <span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Example showing arg order on the stack.</span>
 <span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>