trying to understand the CHARABIA

This commit is contained in:
Mylloon 2023-10-30 16:32:18 +01:00
parent ceb2caa21e
commit 44744cc667
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -336,8 +336,21 @@ let rec evaluate runtime ast =
E, M dv E', M' *)
and definition runtime d =
(* TODO *)
failwith "Students! This is your job!"
match Position.value d with
| DefineValue vd -> value_definition runtime vd
(* On ignore tout ce qui n'est pas une value car on interprète *)
| _ -> runtime
and value_definition runtime = function
| SimpleValue (id, _, expr) ->
(* TODO: Ici il faut associer l'ID et l'expression
* => Retourner l'environnement modifié *)
runtime
| RecFunctions rf ->
(* TODO: Ici faut ajouter les noms des fonctions à l'environnement
* pour qu'elles puissent s'appeller dans leur corps de fonction
* => Il faut retourner un environnement modifié *)
runtime
and expression' environment memory e =
expression (position e) environment memory (value e)