diff --git a/flap/src/hopix/hopixInterpreter.ml b/flap/src/hopix/hopixInterpreter.ml index e77f648..20b46a2 100644 --- a/flap/src/hopix/hopixInterpreter.ml +++ b/flap/src/hopix/hopixInterpreter.ml @@ -439,7 +439,6 @@ and expression pos environment memory = function | TypeAnnotation _ -> VUnit (* On ignore le type car on interprète *) -(* TODO a finir (à commencer plutôt) *) and case_value expr branches environment memory = (* On calcule d'abord l'expression *) let expr' = expression' environment memory expr in @@ -604,9 +603,29 @@ and tuple_pattern environment tab tab2 = and tagged_pattern cons1 cons2 pattern1 pattern2 environment = if cons1.value = cons2 then tuple_pattern environment pattern1 pattern2 else None + and record_pattern environment r r' = - (* TODO *) - None + (*) + match r with + | [] -> Some environment + | field :: reste -> + let labbel_pattern = record_labbel_pattern environment field r' in + match labbel_pattern with + | Some env' -> record_pattern env' reste r' + | None -> None + + + and record_labbel_pattern environment field r' = + match r' with + | [] -> None + | (label,pat) :: reste -> + if (value (fst field)) = label then + match pattern environment (value (snd field)) pat with + | Some env' -> Some env' + | None -> record_labbel_pattern environment field reste + else + record_labbel_pattern environment field reste +*) and literal_pattern pl environment expression = let valeur_literal = pl.value in