blob: 14809cc79806801dae2b422a3a1d4cdca519c17a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
type normal_type
= TP_Int
| TP_Bool
| TP_Array of normal_type
let rec string_of_normal_type = function
| TP_Int -> "int"
| TP_Bool -> "bool"
| TP_Array el -> string_of_normal_type el ^ "[]"
type extended_type = normal_type list
let string_of_extended_type xs =
String.concat ", " @@ List.map string_of_normal_type xs
type result_type
= RT_Unit
| RT_Void
type env_type
= ENVTP_Var of normal_type
| ENVTP_Fn of extended_type * extended_type
let string_of_env_type = function
| ENVTP_Var t -> string_of_normal_type t
| ENVTP_Fn (xs, []) -> Format.sprintf "fn(%s)"
(string_of_extended_type xs)
| ENVTP_Fn (xs, rs) -> Format.sprintf "fn(%s) -> (%s)"
(string_of_extended_type xs)
(string_of_extended_type rs)
|