From 7842d4dc1400ff8d0a701593386c695e5d6d136b Mon Sep 17 00:00:00 2001 From: Nicolas PENELOUX Date: Sat, 4 Nov 2023 10:40:31 +0100 Subject: [PATCH] ajout Tuple et dereference --- flap/src/hopix/hopixInterpreter.ml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/flap/src/hopix/hopixInterpreter.ml b/flap/src/hopix/hopixInterpreter.ml index d0f6ac2..b0588f0 100644 --- a/flap/src/hopix/hopixInterpreter.ml +++ b/flap/src/hopix/hopixInterpreter.ml @@ -381,9 +381,10 @@ and expression _pos environment _memory = function | Field _ -> (* TODO *) failwith "Students! This is your job (Field)!" - | Tuple _ -> - (* TODO *) - failwith "Students! This is your job (Tuple)!" + | Tuple([]) -> (* Cas pour le Tuple vide *) + VUnit (* Un tuple vide ne contient rien (logique), donc on utilise un VUnit*) + | Tuple(list_exp) -> + VTuple(List.map (expression' environment _memory) list_exp) | Sequence _ -> (* TODO *) failwith "Students! This is your job (Sequence)!" @@ -396,9 +397,9 @@ and expression _pos environment _memory = function | Apply _ -> (* TODO *) failwith "Students! This is your job (Apply)!" - | Ref _ -> - (* TODO *) - failwith "Students! This is your job (Ref)!" + | Ref ref -> + let dref = expression' environment _memory ref in + VLocation(Memory.allocate _memory Mint.one dref) | Assign _ -> (* TODO *) failwith "Students! This is your job (Assign)!"