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