tentative de compréhension
This commit is contained in:
parent
ad14b5bd46
commit
ae2b764821
1 changed files with 21 additions and 7 deletions
|
@ -67,21 +67,36 @@ let rec synth_expression
|
|||
: HopixTypes.typing_environment -> HopixAST.expression Position.located
|
||||
-> HopixTypes.aty
|
||||
=
|
||||
fun env Position.{ value = e; position = pos } ->
|
||||
fun env Position.{ value = e; position = pos } -> function
|
||||
| Literal l -> type_of_literal l.value
|
||||
| Variable(id,tlist) -> failwith "Students! This is your job! Variable"
|
||||
| Tagged(cons,_,[]) -> HopixTypes.hbool (*Pas sûr, j'ai regardé comme dans hopixInterpreter au début*)
|
||||
| Apply(a,b) -> failwith "Students! This is your job! Apply"
|
||||
| Record(field,tliste) -> failwith "Students! This is your job! Record"
|
||||
| Fun(_) -> failwith "Students! This is your job! Fun synth" (* TODO : ici on ne peut pas synthesisé. cf Cours*)
|
||||
| TypeAnnotation(expr,t) -> failwith "Students! This is your job! TypeAnnotation"
|
||||
|
||||
|
||||
and type_of_literal l =
|
||||
match l with
|
||||
| LInt _ -> HopixTypes.hint
|
||||
| LChar _ -> HopixTypes.hchar
|
||||
| LString _ -> HopixTypes.hstring
|
||||
|
||||
and check_expression
|
||||
: HopixTypes.typing_environment -> HopixAST.expression Position.located
|
||||
-> HopixTypes.aty -> unit
|
||||
=
|
||||
fun env (Position.{ value = e; position = pos } as exp) expected ->
|
||||
fun env (Position.{ value = e; position = pos } as exp) expected -> function
|
||||
| Fun df -> failwith "Students! This is your job! Fun check"
|
||||
|
||||
|
||||
|
||||
and check_value_definition
|
||||
: HopixTypes.typing_environment -> HopixAST.value_definition
|
||||
-> HopixTypes.typing_environment
|
||||
=
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
fun env -> function
|
||||
fun env -> function
|
||||
| SimpleValue (id, Some ty, ex) ->
|
||||
failwith "Students! This is your job! (check_value_definition | SimpleValue)"
|
||||
| RecFunctions _ ->
|
||||
|
@ -89,7 +104,6 @@ and check_value_definition
|
|||
à faire les fonctions récursives *)
|
||||
failwith "Students! This is your job! (check_value_definition | RecFunctions)"
|
||||
| _ -> failwith "Students! This is your job!"
|
||||
>>>>>>> acd881c0dd51529a11929a7e8abb27d101b9297f
|
||||
;;
|
||||
|
||||
let check_definition env = function
|
||||
|
|
Reference in a new issue