Started work for type inference
This commit is contained in:
@ -1,12 +1,21 @@
|
||||
type variable = string
|
||||
|
||||
let globalIdentifier = ref 1
|
||||
|
||||
module VariableMap = Map.Make(String)
|
||||
module VariableSet = Set.Make(String)
|
||||
|
||||
type ftype =
|
||||
IntegerType
|
||||
| BooleanType
|
||||
| PolimorphicType of string
|
||||
| FunctionType of ftype list * ftype
|
||||
type fsubstitution = (* goes from polimorphic types to types *)
|
||||
ftype VariableMap.t
|
||||
type fenvironment = (* goes from variables to types *)
|
||||
ftype VariableMap.t
|
||||
type typingshape = (* tuple of a simple type environment and a simple type *)
|
||||
fenvironment * ftype
|
||||
|
||||
type t_exp =
|
||||
Integer of int (* x := a *)
|
||||
@ -32,7 +41,7 @@ type t_exp =
|
||||
| CmpGreaterEq of t_exp * t_exp (* x >= x *)
|
||||
| IfThenElse of t_exp * t_exp * t_exp (* if b then c else c *)
|
||||
| LetIn of variable * t_exp * t_exp (* let x = x in x *)
|
||||
| LetFun of variable * variable list * ftype * t_exp * t_exp (* let rec x: t. x in x*)
|
||||
| LetFun of variable * variable list * ftype * t_exp * t_exp (* let rec x: t. x in x *)
|
||||
|
||||
type permittedValues =
|
||||
IntegerPermitted of int
|
||||
|
||||
Reference in New Issue
Block a user