diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-06-15 23:06:07 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-06-15 23:06:07 -0700 |
commit | 99a8ea89e2954f011e1795955f8832bffad84df3 (patch) | |
tree | eeaf95cafb8851c6dc034af88bfe7b66a5293ebc | |
parent | cdc9a7f57f860e2196ec00bdc22458bb0c61c64b (diff) | |
download | mu-99a8ea89e2954f011e1795955f8832bffad84df3.tar.gz |
6539 - arith: start on mul/div
-rw-r--r-- | apps/arith.mu | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/arith.mu b/apps/arith.mu index 18e572e4..6821efcf 100644 --- a/apps/arith.mu +++ b/apps/arith.mu @@ -23,7 +23,7 @@ fn simplify -> result/eax: int, look/esi: byte { # prime the pump look <- get-char # prime the pump look <- skip-spaces look - result, look <- num look + result, look <- term look $simplify:loop: { # operator var op/ecx: byte <- copy 0 @@ -38,7 +38,7 @@ fn simplify -> result/eax: int, look/esi: byte { look <- skip-spaces look { var tmp/eax: int <- copy 0 - tmp, look <- num look + tmp, look <- term look second <- copy tmp } # perform op @@ -61,6 +61,11 @@ fn simplify -> result/eax: int, look/esi: byte { look <- skip-spaces look } +fn term _look: byte -> result/eax: int, look/esi: byte { + look <- copy _look # should be a no-op + result, look <- num look +} + fn operator _look: byte -> op/ecx: byte, look/esi: byte { op <- copy _look look <- get-char |