division fix
This commit is contained in:
parent
176ed2d385
commit
dd73f58eae
@ -114,12 +114,8 @@ class MiniCInterpretVisitor(MiniCVisitor):
|
|||||||
if ctx.myop.type == MiniCParser.MULT:
|
if ctx.myop.type == MiniCParser.MULT:
|
||||||
return lval * rval
|
return lval * rval
|
||||||
elif ctx.myop.type == MiniCParser.DIV:
|
elif ctx.myop.type == MiniCParser.DIV:
|
||||||
if rval == 0:
|
# TODO : interpret division
|
||||||
raise MiniCRuntimeError("Division by 0")
|
raise NotImplementedError()
|
||||||
if isinstance(lval, int):
|
|
||||||
return lval // rval
|
|
||||||
else:
|
|
||||||
return lval / rval
|
|
||||||
elif ctx.myop.type == MiniCParser.MOD:
|
elif ctx.myop.type == MiniCParser.MOD:
|
||||||
# TODO : interpret modulo
|
# TODO : interpret modulo
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
BIN
TP03/tp3.pdf
BIN
TP03/tp3.pdf
Binary file not shown.
Loading…
Reference in New Issue
Block a user