gcc config
[prop.git] / prop-src / collection.pcc
blob641c2aa36e4f0d87a99142dcc8d4bac869d07c9a
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 //  This file implements the analysis and type inference methods for
4 //  SETL-style collection types.
5 //
6 ///////////////////////////////////////////////////////////////////////////////
7 #include <iostream.h>
8 #include "collection.ph"
9 #include "type.h"
11 ///////////////////////////////////////////////////////////////////////////////
13 //  Instantiate the collection type descriptor.
15 ///////////////////////////////////////////////////////////////////////////////
16 instantiate datatype CollectionDesc, List<CollectionDesc>;
18 ///////////////////////////////////////////////////////////////////////////////
20 //  Functions for constructing some SETL-like type constructors.
22 ///////////////////////////////////////////////////////////////////////////////
23 Ty mklistty (Ty a)         
24 {  return TYCONty(COLtycon(COLdesc'{ name = "list" }), #[a]); }
25                              
26 Ty mksetty (Ty a)         
27 {  return TYCONty(COLtycon(COLdesc'{ name = "set" }), #[a]); }
29 Ty mkbagty (Ty a)         
30 {  return TYCONty(COLtycon(COLdesc'{ name = "bag" }), #[a]); }
32 Ty mkmapty (Ty a, Ty b)   
33 {  return TYCONty(COLtycon(COLdesc'{ name = "bag" }), #[a,b]); }
35 Ty mkmultimapty (Ty a, Ty b)   
36 {  return TYCONty(COLtycon(COLdesc'{ name = "bag" }), #[a,b]); }
38 Ty mkqueuety (Ty a)         
39 {  return TYCONty(COLtycon(COLdesc'{ name = "bag" }), #[a]); }
41 Ty mkpriqueuety (Ty a)         
42 {  return TYCONty(COLtycon(COLdesc'{ name = "bag" }), #[a]); }
44 Ty mkdequety (Ty a)        
45 {  return TYCONty(COLtycon(COLdesc'{ name = "bag" }), #[a]); }