diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-03-27 02:08:02 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-03-27 02:08:02 -0700 |
commit | cbec147d3b3c1f7ff7543755b02c08c648cc986f (patch) | |
tree | ff53fbaec694e7a966607ad8bb34eee451a8d835 | |
parent | 93d8141e1e292bc60d97ae2f916925b62466dcd4 (diff) | |
download | mu-cbec147d3b3c1f7ff7543755b02c08c648cc986f.tar.gz |
6173
-rw-r--r-- | html/mu_instructions.html | 17 | ||||
-rw-r--r-- | mu_instructions | 17 |
2 files changed, 24 insertions, 10 deletions
diff --git a/html/mu_instructions.html b/html/mu_instructions.html index f510d850..76a02690 100644 --- a/html/mu_instructions.html +++ b/html/mu_instructions.html @@ -25,11 +25,18 @@ body { font-family: monospace; color: #000000; background-color: #c6c6c6; } <pre id='vimCodeElement'> <span class="SalientComment">## Mu's instructions and their table-driven translation</span> -Mu is a statement-oriented language. Blocks consist of flat lists of instructions. -The following chart shows all the instruction forms supported by Mu, along -with the instruction they're translated to. Variables of the form 'var/reg' -live in a register, and other variables are assumed to live on the stack at -some 'stack-offset' from ebp. +See <a href="http://akkartik.name/akkartik-convivial-20200315.pdf">http://akkartik.name/akkartik-convivial-20200315.pdf</a> for the complete +story. In brief: Mu is a statement-oriented language. Blocks consist of flat +lists of instructions. Instructions can have inputs after the operation, and +outputs to the left of a '<span class="Special"><-</span>'. Inputs and outputs must be variables. They can't +include nested expressions. Variables can be literals ('n'), or live in a +register ('var/reg') or in memory ('var') at some 'stack-offset' from the 'ebp' +register. Outputs must be registers. To modify a variable in memory, pass it in +by reference as an input. (Inputs are more precisely called 'inouts'.) +Conversely, registers that are just read from must not be passed as inputs. + +The following chart shows all the instruction forms supported by Mu, along with +the SubX instruction they're translated to. var/<span class="Constant">eax</span> <span class="Special"><-</span> increment => <span class="Constant">"40/increment-eax"</span> var/<span class="Constant">ecx</span> <span class="Special"><-</span> increment => <span class="Constant">"41/increment-ecx"</span> diff --git a/mu_instructions b/mu_instructions index f9866aca..e0df3496 100644 --- a/mu_instructions +++ b/mu_instructions @@ -1,10 +1,17 @@ ## Mu's instructions and their table-driven translation -Mu is a statement-oriented language. Blocks consist of flat lists of instructions. -The following chart shows all the instruction forms supported by Mu, along -with the instruction they're translated to. Variables of the form 'var/reg' -live in a register, and other variables are assumed to live on the stack at -some 'stack-offset' from ebp. +See http://akkartik.name/akkartik-convivial-20200315.pdf for the complete +story. In brief: Mu is a statement-oriented language. Blocks consist of flat +lists of instructions. Instructions can have inputs after the operation, and +outputs to the left of a '<-'. Inputs and outputs must be variables. They can't +include nested expressions. Variables can be literals ('n'), or live in a +register ('var/reg') or in memory ('var') at some 'stack-offset' from the 'ebp' +register. Outputs must be registers. To modify a variable in memory, pass it in +by reference as an input. (Inputs are more precisely called 'inouts'.) +Conversely, registers that are just read from must not be passed as inputs. + +The following chart shows all the instruction forms supported by Mu, along with +the SubX instruction they're translated to. var/eax <- increment => "40/increment-eax" var/ecx <- increment => "41/increment-ecx" |