division fix

This commit is contained in:
BuildTools 2024-09-30 14:51:00 +02:00
parent 176ed2d385
commit dd73f58eae
2 changed files with 2 additions and 6 deletions

View File

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

Binary file not shown.