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-05 12:13:57 +02:00
|
|
|
|
|
|
|
type ty = | Tprod of ty list | Tid of longname | Tarray of ty * static_exp
|
|
|
|
|
|
|
|
type static_exp = { se_desc: static_exp_desc; se_typ: loc: location }
|
|
|
|
| Svar of name
|
|
|
|
| Sint of int
|
|
|
|
| Sfloat of float
|
|
|
|
| Sbool of bool
|
|
|
|
| Sconstructor of longname
|
|
|
|
| Stuple of static_exp list
|
|
|
|
| Sarray_power of static_exp * static_exp (** power : 0^n : [0,0,0,0,0,..] *)
|
|
|
|
| Sarray of static_exp list (** [ e1, e2, e3 ] *)
|
|
|
|
| Sop of longname * static_exp list (** defined ops for now in pervasives *)
|
2010-06-15 14:05:26 +02:00
|
|
|
|
2010-06-16 17:03:45 +02:00
|
|
|
let invalid_type = Tprod []
|
2010-06-15 14:05:26 +02:00
|
|
|
|
2010-07-05 12:13:57 +02:00
|
|
|
let const_array_of ty n = Tarray (ty, SConst n) (* TODO ??? *)
|
2010-06-16 19:31:51 +02:00
|
|
|
|
|
|
|
open Pp_tools
|
|
|
|
open Format
|
|
|
|
|
|
|
|
let rec print_type ff = function
|
|
|
|
| Tprod ty_list ->
|
|
|
|
fprintf ff "@[<hov2>%a@]" (print_list_r print_type "(" " *" ")") ty_list
|
|
|
|
| Tid id -> print_longname ff id
|
|
|
|
| Tarray (ty, n) ->
|
2010-06-30 17:20:56 +02:00
|
|
|
fprintf ff "@[<hov2>%a^%a@]" print_type ty print_static_exp n
|