2010-06-15 14:05:26 +02:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Heptagon *)
|
|
|
|
(* *)
|
|
|
|
(* Author : Marc Pouzet *)
|
|
|
|
(* Organization : Demons, LRI, University of Paris-Sud, Orsay *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
2010-07-05 12:13:57 +02:00
|
|
|
|
2010-06-15 14:05:26 +02:00
|
|
|
open Names
|
2010-07-08 17:41:00 +02:00
|
|
|
open Misc
|
2010-07-05 16:55:14 +02:00
|
|
|
open Location
|
2010-07-05 12:13:57 +02:00
|
|
|
|
2011-01-05 15:51:55 +01:00
|
|
|
|
2010-07-05 16:55:14 +02:00
|
|
|
type static_exp = { se_desc: static_exp_desc; se_ty: ty; se_loc: location }
|
|
|
|
|
|
|
|
and static_exp_desc =
|
2010-07-07 15:11:32 +02:00
|
|
|
| Svar of constant_name
|
2010-07-05 12:13:57 +02:00
|
|
|
| Sint of int
|
|
|
|
| Sfloat of float
|
|
|
|
| Sbool of bool
|
2011-05-10 16:55:46 +02:00
|
|
|
| Sstring of string (** without enclosing quotes *)
|
2010-07-07 15:11:32 +02:00
|
|
|
| Sconstructor of constructor_name
|
2010-09-13 12:05:10 +02:00
|
|
|
| Sfield of field_name
|
2010-07-05 12:13:57 +02:00
|
|
|
| Stuple of static_exp list
|
2011-05-26 18:39:33 +02:00
|
|
|
| Sarray_power of static_exp * (static_exp list) (** power : 0^n^m : [[0,0,..],[0,0,..],..] *)
|
2010-07-05 12:13:57 +02:00
|
|
|
| Sarray of static_exp list (** [ e1, e2, e3 ] *)
|
2010-07-07 15:11:32 +02:00
|
|
|
| Srecord of (field_name * static_exp) list (** { f1 = e1; f2 = e2; ... } *)
|
|
|
|
| Sop of fun_name * static_exp list (** defined ops for now in pervasives *)
|
2010-06-15 14:05:26 +02:00
|
|
|
|
2010-11-23 17:10:11 +01:00
|
|
|
and ty =
|
2011-01-20 23:05:18 +01:00
|
|
|
| Tprod of ty list (** Product type used for tuples *)
|
|
|
|
| Tid of type_name (** Usable type_name are alias or pervasives {bool,int,float} (see [Initial]) *)
|
2011-05-26 18:39:33 +02:00
|
|
|
| Tarray of ty * static_exp (** [base_type] * [size] *) (* ty should not be prod *)
|
2011-04-12 16:02:03 +02:00
|
|
|
| Tinvalid
|
2010-07-07 12:15:02 +02:00
|
|
|
|
2011-04-12 16:02:03 +02:00
|
|
|
let invalid_type = Tinvalid (** Invalid type given to untyped expression etc. *)
|
2010-06-15 14:05:26 +02:00
|
|
|
|
2010-07-21 17:19:51 +02:00
|
|
|
let prod = function
|
|
|
|
| [ty] -> ty
|
|
|
|
| ty_list -> Tprod ty_list
|
|
|
|
|
2011-01-24 16:07:26 +01:00
|
|
|
let unprod = function
|
|
|
|
| Tprod l -> l
|
|
|
|
| t -> [t]
|
|
|
|
|
2011-04-12 16:02:03 +02:00
|
|
|
let mk_static_exp ?(loc = no_location) ty desc = (*note ~ty: replace as first arg*)
|
2010-07-05 16:55:14 +02:00
|
|
|
{ se_desc = desc; se_ty = ty; se_loc = loc }
|
2010-06-16 19:31:51 +02:00
|
|
|
|
2010-07-08 17:41:00 +02:00
|
|
|
|