division entières
This commit is contained in:
		| @ -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
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								spf.py
									
									
									
									
									
								
							| @ -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): | ||||
|  | ||||
		Reference in New Issue
	
	Block a user