Skip to content

Commit

Permalink
(add) runtime: add remaining arithmetic operations
Browse files Browse the repository at this point in the history
These unfortunately only work on integers for now.
  • Loading branch information
xTrayambak committed Sep 28, 2024
1 parent 8a6e1bf commit dc89dae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/bali/runtime/interpreter.nim
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ proc generateIR*(
runtime.ir.addInt(leftIdx, rightIdx)
of BinaryOperation.Sub:
runtime.ir.subInt(leftIdx, rightIdx)
of BinaryOperation.Mult:
runtime.ir.multInt(leftIdx, rightIdx)
of BinaryOperation.Div:
runtime.ir.divInt(leftIdx, rightIdx)
of BinaryOperation.Equal:
runtime.ir.equate(leftIdx, rightIdx)
# FIXME: really weird bug in mirage's IR generator. wtf?
Expand Down
6 changes: 6 additions & 0 deletions tests/data/full-arith.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let x = 32
let y = 5

var z = x / 2

console.log(z)

0 comments on commit dc89dae

Please sign in to comment.