add support for rational numbers, division.

This commit is contained in:
Mark Thom
2017-12-02 11:10:25 -07:00
parent a65adf960e
commit 9a7419c507
10 changed files with 218 additions and 71 deletions

View File

@@ -212,8 +212,12 @@ impl fmt::Display for ArithmeticInstruction {
write!(f, "sub {}, {}, @{}", a1, a2, t),
&ArithmeticInstruction::Mul(ref a1, ref a2, ref t) =>
write!(f, "mul {}, {}, @{}", a1, a2, t),
&ArithmeticInstruction::Div(ref a1, ref a2, ref t) =>
write!(f, "div {}, {}, @{}", a1, a2, t),
&ArithmeticInstruction::IDiv(ref a1, ref a2, ref t) =>
write!(f, "idiv {}, {}, @{}", a1, a2, t),
&ArithmeticInstruction::RDiv(ref a1, ref a2, ref t) =>
write!(f, "rdiv {}, {}, @{}", a1, a2, t),
&ArithmeticInstruction::Neg(ref a, ref t) =>
write!(f, "neg {}, @{}", a, t)
}