diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/arith.mu | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/arith.mu b/apps/arith.mu index 743480de..53566ed5 100644 --- a/apps/arith.mu +++ b/apps/arith.mu @@ -64,7 +64,7 @@ fn simplify -> result/eax: int, look/esi: byte { fn term _look: byte -> result/eax: int, look/esi: byte { look <- copy _look # should be a no-op look <- skip-spaces look - result, look <- num look + result, look <- factor look $term:loop: { # operator var op/ecx: byte <- copy 0 @@ -84,7 +84,7 @@ fn term _look: byte -> result/eax: int, look/esi: byte { look <- skip-spaces look { var tmp/eax: int <- copy 0 - tmp, look <- num look + tmp, look <- factor look second <- copy tmp } # perform op @@ -106,6 +106,12 @@ fn term _look: byte -> result/eax: int, look/esi: byte { } } +fn factor _look: byte -> result/eax: int, look/esi: byte { + look <- copy _look # should be a no-op + look <- skip-spaces look + result, look <- num look +} + fn is-mul-or-div? c: byte -> result/eax: bool { $is-mul-or-div?:body: { compare c, 0x2a |