6539 - arith: start on mul/div

This commit is contained in:
Kartik Agaram 2020-06-15 23:06:07 -07:00
parent cdc9a7f57f
commit 99a8ea89e2
1 changed files with 7 additions and 2 deletions

View File

@ -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