division entières

This commit is contained in:
Anthony Debucquoy 2025-03-23 00:08:42 +01:00
parent 1015a0947e
commit de80ed0dba
Signed by: tonitch
GPG Key ID: A78D6421F083D42E
2 changed files with 9 additions and 3 deletions

View File

@ -7,6 +7,12 @@ ajouter 3 dans l;
afficher l;
entier x = 3;
entier y = 4;
entier z = x + 3 * y + 6 / 3;
#
# afficher x vaut y;
# afficher x ne vaut pas y;
@ -19,7 +25,7 @@ afficher l;
# entier x = 2 + 3 * 4;
# entier y = 3 * 4 + 2;
liste l = [1, 2, 3];
# liste l = [1, 2, 3];
afficher l[2];

4
spf.py
View File

@ -99,8 +99,8 @@ class SPFInterpreter(lark.visitors.Interpreter):
return result[0]
if result[1][0].type == "TIMES_OP":
return result[0] * result[1][1]
elif result[1][0].type == "DIVIDE_OP":
return result[0] / result[1][1]
elif result[1][0].type == "DIVIDE_OP": # Division entière car nous ne gérons pas les flotants
return result[0] // result[1][1]
assert "Unreachable"
def priority(self, el):