2024-04-16 10:07:09 +02:00
|
|
|
open Lam
|
2024-04-15 12:07:49 +02:00
|
|
|
open Types
|
2024-04-09 11:09:33 +02:00
|
|
|
|
|
|
|
(* fonction d'affichage *)
|
2024-04-15 12:07:49 +02:00
|
|
|
let rec string_of_ty = function
|
|
|
|
TVar s -> s
|
|
|
|
| Arr(t1, t2) ->
|
|
|
|
let s1 = string_of_ty t1 in
|
|
|
|
let s2 = string_of_ty t2 in
|
2024-04-16 10:07:09 +02:00
|
|
|
"(" ^ s1 ^ " -> " ^ s2 ^ ")"
|
|
|
|
| Bot -> "False"
|
2024-04-15 12:07:49 +02:00
|
|
|
|
2024-04-09 11:30:52 +02:00
|
|
|
let rec string_of_expr = function
|
2024-04-15 12:07:49 +02:00
|
|
|
Fun ((s, t), e) ->
|
|
|
|
let s_ty = string_of_ty t in
|
|
|
|
let s_e = string_of_expr e in
|
|
|
|
"fun (" ^ s ^ " : " ^ s_ty ^ ") => (" ^ s_e ^ ")"
|
|
|
|
| App (e1, e2) ->
|
2024-04-16 10:07:09 +02:00
|
|
|
"("^(string_of_expr e1)^" "^(string_of_expr e2)^")"
|
2024-04-09 11:30:52 +02:00
|
|
|
| Var (s) -> s
|
2024-04-16 10:07:09 +02:00
|
|
|
| Exf (e, t) ->
|
|
|
|
let s_e = string_of_expr e in
|
|
|
|
let s_ty = string_of_ty t in
|
|
|
|
"exf (" ^ s_e ^ " : " ^ s_ty ^ ")"
|
2024-04-09 11:30:52 +02:00
|
|
|
|
2024-04-15 12:07:49 +02:00
|
|
|
|
2024-04-16 10:07:09 +02:00
|
|
|
let print_ty t =
|
|
|
|
print_string (string_of_ty t)
|
|
|
|
|
2024-04-09 11:30:52 +02:00
|
|
|
let print_expr e =
|
|
|
|
print_string (string_of_expr e)
|
2024-04-09 11:09:33 +02:00
|
|
|
|
2024-04-16 10:07:09 +02:00
|
|
|
|
|
|
|
let affiche_val _ = print_string "TODO"
|