about summary refs log tree commit diff
path: root/users/wpcarro/scratch/compiler/types.ml
blob: 0acd05737cdcabb0559f69f61f7167a6b1f6f255 (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 literal 
  = LiteralInt of int 
  | LiteralBool of bool
  | LiteralString of string

(* Lambda Calculus definition *)
type value =
  | ValueLiteral of literal
  | ValueVariable of string
  | ValueFunction of string * value
  | ValueApplication of value * value
  | ValueVarApplication of string * value
  | ValueBinder of string * value * value

module FromString = Map.Make (String)

type _type =
  | TypeInt
  | TypeBool
  | TypeString
  | TypeVariable of string
  | TypeArrow of _type * _type

type quantified_type = QuantifiedType of string list * _type

type set = bool FromString.t
type substitution = _type FromString.t

type env = quantified_type FromString.t

type inference = Inference of substitution * _type