heptagon/compiler/global/initial.ml

46 lines
1.5 KiB
OCaml
Raw Normal View History

2010-06-15 10:49:03 +02:00
(**************************************************************************)
(* *)
(* Heptagon *)
(* *)
(* Author : Marc Pouzet *)
(* Organization : Demons, LRI, University of Paris-Sud, Orsay *)
(* *)
(**************************************************************************)
(* initialization of the typing environment *)
open Names
open Types
2010-06-15 10:49:03 +02:00
let tglobal = []
let cglobal = []
let pbool = { qual = Pervasives; name = "bool" }
2011-01-24 16:07:26 +01:00
let tbool = Types.Tid pbool
let ptrue = { qual = Pervasives; name = "true" }
let pfalse = { qual = Pervasives; name = "false" }
let por = { qual = Pervasives; name = "or" }
let pint = { qual = Pervasives; name = "int" }
2011-01-24 16:07:26 +01:00
let tint = Types.Tid pint
let pfloat = { qual = Pervasives; name = "float" }
2011-01-24 16:07:26 +01:00
let tfloat = Types.Tid pfloat
2010-06-15 10:49:03 +02:00
let mk_pervasives s = { qual = Pervasives; name = s }
2010-07-05 16:55:14 +02:00
let mk_static_int_op op args =
2011-01-24 16:07:26 +01:00
mk_static_exp ~ty:tint (Sop (op,args))
let mk_static_int i =
2011-01-24 16:07:26 +01:00
mk_static_exp ~ty:tint (Sint i)
let mk_static_bool b =
2011-01-24 16:07:26 +01:00
mk_static_exp ~ty:tbool (Sbool b)
2010-06-15 10:49:03 +02:00
(* build the initial environment *)
let initialize modul =
Modules.initialize modul;
List.iter (fun (f, ty) -> Modules.add_type f ty) tglobal;
List.iter (fun (f, ty) -> Modules.add_constrs f ty) cglobal