From 44744cc6672b1128d925b998f47884defe97f629 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 30 Oct 2023 16:32:18 +0100 Subject: [PATCH] trying to understand the CHARABIA --- flap/src/hopix/hopixInterpreter.ml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/flap/src/hopix/hopixInterpreter.ml b/flap/src/hopix/hopixInterpreter.ml index b12fff8..faa02e8 100644 --- a/flap/src/hopix/hopixInterpreter.ml +++ b/flap/src/hopix/hopixInterpreter.ml @@ -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)