35 lines
770 B
OCaml
35 lines
770 B
OCaml
open Lam
|
|
open Types
|
|
|
|
(* fonction d'affichage *)
|
|
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
|
|
"(" ^ s1 ^ " -> " ^ s2 ^ ")"
|
|
| Bot -> "False"
|
|
|
|
let rec string_of_expr = function
|
|
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) ->
|
|
"("^(string_of_expr e1)^" "^(string_of_expr e2)^")"
|
|
| Var (s) -> s
|
|
| Exf (e, t) ->
|
|
let s_e = string_of_expr e in
|
|
let s_ty = string_of_ty t in
|
|
"exf (" ^ s_e ^ " : " ^ s_ty ^ ")"
|
|
|
|
|
|
let print_ty t =
|
|
print_string (string_of_ty t)
|
|
|
|
let print_expr e =
|
|
print_string (string_of_expr e)
|
|
|
|
|
|
let affiche_val _ = print_string "TODO"
|