interpretation max (0/72 :))))) )
This commit is contained in:
parent
44744cc667
commit
2961872f99
1 changed files with 71 additions and 9 deletions
|
@ -343,13 +343,20 @@ and definition runtime d =
|
|||
|
||||
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
|
||||
(* Ici on associe l'ID et l'expression
|
||||
* => Retourne l'environnement modifié *)
|
||||
let env' =
|
||||
Environment.bind
|
||||
runtime.environment
|
||||
id.value
|
||||
(expression' runtime.environment runtime.memory expr)
|
||||
in
|
||||
{ runtime with environment = env' }
|
||||
| RecFunctions _rf ->
|
||||
(* Ici on ajoute les noms des fonctions à l'environnement
|
||||
* pour qu'elles puissent s'appeller dans leur corps de fonction
|
||||
* => Il faut retourner un environnement modifié *)
|
||||
* => Retourne l'environnement modifié *)
|
||||
(* TODO *)
|
||||
runtime
|
||||
|
||||
and expression' environment memory e =
|
||||
|
@ -360,9 +367,64 @@ and expression' environment memory e =
|
|||
E, M ⊢ e ⇓ v, M'
|
||||
|
||||
and E = [runtime.environment], M = [runtime.memory]. *)
|
||||
and expression _ environment memory =
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job!"
|
||||
and expression _pos environment _memory = function
|
||||
| Literal l -> literal_expression l.value
|
||||
| Variable (id, _) ->
|
||||
(* On cherche l'id dans l'environnement *)
|
||||
Environment.lookup id.position id.value environment
|
||||
| Tagged _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Tagged)!"
|
||||
| Record _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Record)!"
|
||||
| Field _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Field)!"
|
||||
| Tuple _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Tuple)!"
|
||||
| Sequence _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Sequence)!"
|
||||
| Define _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Define)!"
|
||||
| Fun _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Fun)!"
|
||||
| Apply _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Apply)!"
|
||||
| Ref _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Ref)!"
|
||||
| Assign _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Assign)!"
|
||||
| Read _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Read)!"
|
||||
| Case _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (Case)!"
|
||||
| IfThenElse _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (IfThenElse)!"
|
||||
| While _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (While)!"
|
||||
| For _ ->
|
||||
(* TODO *)
|
||||
failwith "Students! This is your job (For)!"
|
||||
| TypeAnnotation _ ->
|
||||
(* On ignore le type car on interprète *)
|
||||
VUnit
|
||||
|
||||
and literal_expression = function
|
||||
| LInt n -> VInt n
|
||||
| LChar c -> VChar c
|
||||
| LString s -> VString s
|
||||
|
||||
(** This function returns the difference between two runtimes. *)
|
||||
and extract_observable runtime runtime' =
|
||||
|
|
Reference in a new issue