This commit is contained in:
augustin64 2024-10-03 10:22:51 +02:00
commit 6a9701b16a
4 changed files with 13 additions and 7 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()

View File

@ -31,7 +31,7 @@ _Academic first semester 2024-2025_
# Week 3:
- :hammer: Lab 2: Thursday 23/09/2023, 13h30-15h30. Room E001 (Samuel Humeau & Emma Nardino)
- :hammer: Lab 2: Thursday 23/09/2023, 13h30-15h30. Room E001 103 & -138 (Grenat) (Samuel Humeau & Emma Nardino)
* Lexing & Parsing with ANTLR4 [TP02](TP02/tp2.pdf).
* Code in [TP02/](TP02/).
@ -41,3 +41,13 @@ _Academic first semester 2024-2025_
* Interpreters: [transparents](course/capmif_cours03_interpreters.pdf).
* 3 Address code generation: [transparents](course/capmif_cours05_3ad_codegen.pdf).
# Week 4:
- hammer: Lab 3: Monday 30/09/2024, 13h30-15h30. Room E001 (Samuel Humeau & Emma Nardino)
* Interpreter & Typer [TP03](TP03/tp3.pdf).
* Code in [TP03/](TP03/) and [MiniC/TP03/](MiniC/TP03/).
- :book: Course: Thursday 3/10/2024, 10h15-12h15. Amphi B (Gabriel Radanne)
* CFG [slides in english](course/capmif_cours06_irs.pdf).

Binary file not shown.

Binary file not shown.