hobbes
a language, embedded compiler, and runtime for efficient dynamic expression evaluation, data storage and analysis
tylift.H
Go to the documentation of this file.
1 
2 #ifndef HOBBES_LANG_TYPELIFT_HPP_INCLUDED
3 #define HOBBES_LANG_TYPELIFT_HPP_INCLUDED
4 
5 #include <hobbes/lang/type.H>
6 #include <hobbes/util/array.H>
7 #include <hobbes/util/ptr.H>
8 #include <hobbes/util/str.H>
9 #include <hobbes/util/variant.H>
11 #include <string>
12 #include <vector>
13 #include <set>
14 #include <map>
15 #include <stdexcept>
16 
17 namespace hobbes {
18 
19 /*********
20  * typedb : an interface to a type environment
21  *********/
22 struct typedb {
23  // define new opaque types with an internal representation
24  virtual MonoTypePtr defineNamedType(const std::string& name, const str::seq& argNames, const MonoTypePtr& ty) = 0;
25  virtual bool isTypeName(const std::string&) const = 0;
26  virtual MonoTypePtr namedTypeRepresentation(const std::string&) const = 0;
27 
28  // define new type aliases
29  virtual void defineTypeAlias(const std::string& name, const str::seq& argNames, const MonoTypePtr& ty) = 0;
30  virtual bool isTypeAliasName(const std::string& name) const = 0;
31  virtual MonoTypePtr replaceTypeAliases(const MonoTypePtr& ty) const = 0;
32 
33  // handle wrapping C++ types
34  virtual PolyTypePtr opaquePtrPolyType(const std::type_info&, unsigned int sz, bool inStruct) = 0;
35  virtual MonoTypePtr opaquePtrMonoType(const std::type_info&, unsigned int sz, bool inStruct) = 0;
36 
37  // insert subtype coercions as necessary to witness C++ inheritance
38  virtual PolyTypePtr generalize(const MonoTypePtr& mt) const = 0;
39 };
40 
41 struct nulltypedb : public typedb {
42  MonoTypePtr defineNamedType(const std::string& name, const str::seq& argNames, const MonoTypePtr& ty);
43  bool isTypeName(const std::string&) const;
44  MonoTypePtr namedTypeRepresentation(const std::string&) const;
45 
46  void defineTypeAlias(const std::string& name, const str::seq& argNames, const MonoTypePtr& ty);
47  bool isTypeAliasName(const std::string& name) const;
49 
50  PolyTypePtr opaquePtrPolyType(const std::type_info&, unsigned int sz, bool inStruct);
51  MonoTypePtr opaquePtrMonoType(const std::type_info&, unsigned int sz, bool inStruct);
52 
53  PolyTypePtr generalize(const MonoTypePtr& mt) const;
54 };
55 extern nulltypedb nulltdb;
56 
57 /*************
58  * C++ representations for common hobbes types
59  *************/
60 
61 // allow opaque type aliases to reuse basic types
62 template <const char* TN, typename T>
63  struct typeAlias {
64  typeAlias(const T& v) : value(v) { }
65  typeAlias() { }
66  T value;
67  };
68 
69 // allow the generic definition of simple recursive types
70 template <typename T>
71  struct recursive {
72  T value;
73  };
74 struct recursion {
75  void* value;
76  recursion(void* x) : value(x) { }
77 };
78 
79 // represent arrays of unknown length by a size and a variable-length array payload
80 template <typename T>
81  struct array {
82  typedef array<T>* ptr;
83 
84  long size;
85  T data[1]; // unknown length, bytes inline with this structure
86  };
87 template <typename T> const T* begin(const array<T>* d) { return d->data; }
88 template <typename T> const T* end (const array<T>* d) { return d->data + d->size; }
89 template <typename T> T* begin( array<T>* d) { return d->data; }
90 template <typename T> T* end ( array<T>* d) { return d->data + d->size; }
91 
92 template <typename T> const T* begin(const array<T>& d) { return d.data; }
93 template <typename T> const T* end (const array<T>& d) { return d.data + d.size; }
94 template <typename T> T* begin( array<T>& d) { return d.data; }
95 template <typename T> T* end ( array<T>& d) { return d.data + d.size; }
96 
97 // a linked list is a recursive sum of nested tuples starting at unit
98 template <typename T>
99  struct seq {
100  typedef std::pair<T, seq<T>*> pair_t;
102  rep_t data;
103 
104  seq() : data(unit()) { }
105  seq(const T& x, seq<T>* xs) : data(pair_t(x, xs)) { }
106 
107  bool empty() const { return get<unit>(this->data) != 0; }
108  const pair_t* head() const { return get<pair_t>(this->data); }
109  };
110 
111 /******************
112  * lift(T) : map C++ types to hobbes type descriptions
113  ******************/
114 template <typename T, bool InStruct = false, typename P = void>
115  struct lift;
116 
117 // the default lift just refers to opaque C++ data (either as pointers or inline data)
118 template <typename T, bool InStruct> struct opaquePtrLift { };
119 template <typename T> struct opaquePtrLift<T,true> { static MonoTypePtr type() { return OpaquePtr::make(str::demangle<T>(), sizeof(T), true); } };
120 template <typename T> struct opaquePtrLift<T,false> { static MonoTypePtr type() { return OpaquePtr::make(str::demangle<T>(), 0, false); } };
121 
122 // also by default : strip 'const' annotations and rewrite references to pointers
123 template <typename T, bool InStruct> struct defaultLift { static MonoTypePtr type(typedb&) { return opaquePtrLift<T,InStruct>::type(); } };
124 template <typename T, bool InStruct> struct defaultLift<const T*, InStruct> : public lift<T*, InStruct> { };
125 template <typename T, bool InStruct> struct defaultLift<const T&, InStruct> : public lift<T*, InStruct> { };
126 template <typename T, bool InStruct> struct defaultLift<T&, InStruct> : public lift<T*, InStruct> { };
127 
128 template <typename T, bool InStruct>
129  struct defaultLift<T*, InStruct> {
130  static MonoTypePtr type(typedb& tenv) {
131  return tenv.opaquePtrMonoType(typeid(T), 0, false);
132  }
133  };
134 template <typename T, bool InStruct, typename P>
135  struct lift {
136  static MonoTypePtr type(typedb& tenv) {
137  return defaultLift<T, InStruct>::type(tenv);
138  }
139  };
140 
141 // conflate the various names for std::string
142 template <>
143  struct lift<std::string, true> { static MonoTypePtr type(typedb&) { return OpaquePtr::make("std::string", sizeof(std::string), true); } };
144 template <bool InStruct>
145  struct lift<std::string*, InStruct> { static MonoTypePtr type(typedb&) { return OpaquePtr::make("std::string", InStruct ? sizeof(std::string) : 0, InStruct); } };
146 
147 // we can lift a list of T as ^x.()+T*x, represented by a pointer whether top-level or inline
148 template <typename T>
149  struct liftSeq {
150  static MonoTypePtr type(typedb& tenv) {
151  // ^x.()+T*x
152  return Recursive::make("x", Variant::make(list(Variant::Member(".f0", primty("unit"), 0), Variant::Member(".f1", tuple(list(lift<T, true>::type(tenv), tvar("x"))), 1))));
153  }
154  };
155 
156 template <typename T, bool InStruct>
157  struct lift< seq<T>*, InStruct > : public liftSeq<T> { };
158 
159 // or a generic recursive type as with lists
160 template <typename T>
161  struct liftRecursive {
162  static MonoTypePtr type(typedb& tenv) {
163  return Recursive::make("x", lift<T, true>::type(tenv));
164  }
165  };
166 
167 template <typename T, bool InStruct>
168  struct lift< recursive<T>*, InStruct > : public liftRecursive<T> { };
169 
170 template <bool InStruct>
171  struct lift< recursion, InStruct > {
173  return tvar("x");
174  }
175  };
176 
177 // we can lift any pair as a tuple (at the top-level must be a pointer rep, else not)
178 template <typename F, typename S>
179  struct liftPair {
180  static MonoTypePtr type(typedb& tenv) {
181  typedef std::pair<F,S> FS;
182  Record::Members fs;
183  fs.push_back(Record::Member(".f0", lift<F, true>::type(tenv), offsetof(FS, first)));
184  fs.push_back(Record::Member(".f1", lift<S, true>::type(tenv), offsetof(FS, second)));
185  return Record::make(fs);
186  }
187  };
188 
189 template <typename F, typename S>
190  struct lift< std::pair<F, S>, true > : public liftPair<F, S> { };
191 template <typename F, typename S>
192  struct lift< std::pair<F, S>*, false > : public liftPair<F, S> { };
193 
194 // lift only indeterminate-length arrays passed by reference
195 // (arrays are always represented by a pointer but should internally store inline)
196 template <typename T>
197  struct liftVarArray {
198  static MonoTypePtr type(typedb& tenv) {
199  return Array::make(lift<T, true>::type(tenv));
200  }
201  };
202 
203 template <typename T, bool InStruct>
204  struct lift< array<T>*, InStruct> : public liftVarArray<T> { };
205 
206 // lift the basic primitive types
207 #define HOBBES_LIFT_PRIMITIVE(T, n) \
208  template <bool InStruct> \
209  struct lift<T, InStruct> { \
210  static MonoTypePtr type(typedb&) { \
211  return Prim::make(#n); \
212  } \
213  }
214 
217 HOBBES_LIFT_PRIMITIVE(bool, bool);
218 HOBBES_LIFT_PRIMITIVE(char, char);
219 HOBBES_LIFT_PRIMITIVE(unsigned char, byte);
220 HOBBES_LIFT_PRIMITIVE(short, short);
221 HOBBES_LIFT_PRIMITIVE(unsigned short, short);
222 HOBBES_LIFT_PRIMITIVE(int, int);
223 HOBBES_LIFT_PRIMITIVE(unsigned int, int);
224 HOBBES_LIFT_PRIMITIVE(long, long);
225 HOBBES_LIFT_PRIMITIVE(unsigned long, long);
226 HOBBES_LIFT_PRIMITIVE(long long, long);
227 HOBBES_LIFT_PRIMITIVE(unsigned long long, long);
228 HOBBES_LIFT_PRIMITIVE(float, float);
229 HOBBES_LIFT_PRIMITIVE(double, double);
230 
231 template <typename T>
232  inline MonoTypePtr prim() { return lift<T, false>::type(nulltdb); }
233 
234 // introduce opaque (named) alias types
235 template <const char* TN, typename T, bool InStruct>
236  struct lift< typeAlias<TN, T>, InStruct > {
237  static MonoTypePtr type(typedb& tenv) {
238  return tenv.defineNamedType(TN, str::seq(), lift<T, InStruct>::type(tenv));
239  }
240  };
241 
242 template <const char* TN, typename T, bool InStruct>
243  struct lift< typeAlias<TN, T>*, InStruct > {
244  static MonoTypePtr type(typedb& tenv) {
245  return tenv.defineNamedType(TN, str::seq(), lift<T*, InStruct>::type(tenv));
246  }
247  };
248 
249 // generic case for fixed-size arrays (has to be by reference to match)
250 // values are stored inline in fixed-size arrays
251 template <typename T, size_t N>
252  struct liftFixedArray {
253  static MonoTypePtr type(typedb& tenv) {
254  return arrayty(lift<T, true>::type(tenv), N);
255  }
256  };
257 
258 template <typename T, size_t N, bool InStruct>
259  struct lift<T(&)[N], InStruct> : public liftFixedArray<T, N> { };
260 template <typename T, size_t N, bool InStruct>
261  struct lift<const T(&)[N], InStruct> : public liftFixedArray<T, N> { };
262 template <typename T, size_t N, bool InStruct>
263  struct lift<T(*)[N], InStruct> : public liftFixedArray<T, N> { };
264 template <typename T, size_t N, bool InStruct>
265  struct lift<const T(*)[N], InStruct> : public liftFixedArray<T, N> { };
266 template <typename T, size_t N, bool InStruct>
267  struct lift<T[N], InStruct> : public liftFixedArray<T, N> { };
268 template <typename T, size_t N, bool InStruct>
269  struct lift<const T[N], InStruct> : public liftFixedArray<T, N> { };
270 
271 // generated lifts for C functions
272 template <typename ... Ts>
273  struct typeSeq {
274  static void accum(MonoTypes*, typedb&) { }
275  static MonoTypes liftSeq(typedb&) { return MonoTypes(); }
276  };
277 template <typename T, typename ... Ts>
278  struct typeSeq<T, Ts...> {
279  static void accum(MonoTypes* r, typedb& tenv) {
280  r->push_back(lift<T, false>::type(tenv));
281  typeSeq<Ts...>::accum(r, tenv);
282  }
283  static MonoTypes liftSeq(typedb& tenv) { MonoTypes r; accum(&r, tenv); return r; }
284  };
285 
286 template <typename F>
287  struct liftFunction { };
288 
289 template <typename R, typename ... Args>
290  struct liftFunction<R(Args...)> {
291  static MonoTypePtr type(typedb& tenv) {
293  }
294  };
295 
296 template <typename R, typename ... Args>
297  struct lift<R(Args...), true> : public liftFunction<R(Args...)> { };
298 template <typename R, typename ... Args>
299  struct lift<R(Args...), false> : public liftFunction<R(Args...)> { };
300 template <typename R, typename ... Args>
301  struct lift<R(*)(Args...), true> : public liftFunction<R(Args...)> { };
302 template <typename R, typename ... Args>
303  struct lift<R(*)(Args...), false> : public liftFunction<R(Args...)> { };
304 
305 // lift variant types
306 // -- first by lifting constructor names
307 // if label(N,T) then the constructor name is N, else it's derived from its position in the total sum type
308 // -- then as with the hobbes::variant layout
309 template <const char* TN, typename T>
310  struct label {
311  typedef T type;
312  T value;
313  label(const T& x) : value(x) { }
314  static std::string name() { return TN; }
315  };
316 template <typename T, typename P = void>
317  struct liftVarCtor {
318  typedef T type;
319  static std::string labelText(int idx) { return ".f" + str::from(idx); }
320  };
321 template <const char* TN, typename T>
322  struct liftVarCtor< label<TN, T> > {
323  typedef typename label<TN, T>::type type;
324  static std::string labelText(int idx) { return label<TN, T>::name(); }
325  };
326 template <typename ... CTys>
327  struct liftVarCtors {
329  };
330 template <typename CTy, typename ... CTys>
331  struct liftVarCtors<CTy, CTys...> {
332  static void constructors(typedb& tenv, Variant::Members* ms) {
333  ms->push_back(Variant::Member(liftVarCtor<CTy>::labelText(ms->size()), lift< typename liftVarCtor<CTy>::type, true >::type(tenv), ms->size()));
335  }
336  };
337 
338 template <typename T>
339  struct liftVariant { };
340 template <typename ... CTys>
341  struct liftVariant< variant<CTys...> > {
342  static MonoTypePtr type(typedb& tenv) {
343  Variant::Members ms;
346  const Variant* vty = is<Variant>(result);
347  size_t vsz = vty->size();
348  size_t csz = sizeof(variant<CTys...>);
349  if (vsz != csz) {
350  size_t offset = vty->payloadOffset();
351  size_t psz = vty->payloadSize();
352  throw std::runtime_error(
353  "Internal error, computed size for variant '" + show(result) + "' (" +
354  str::from(offset) + "+" + str::from(psz) + "(+" + str::from(vsz - (offset + psz)) +
355  ")) inconsistent with C++ memory layout (size=" + str::from(csz) + ")"
356  );
357  }
358  return result;
359  }
360  };
361 
362 template <typename ... CTys>
363  struct lift< variant<CTys...>, true > : public liftVariant< variant<CTys...> > { };
364 template <typename ... CTys>
365  struct lift< variant<CTys...>*, false > : public liftVariant< variant<CTys...> > { };
366 
367 // allow basic reflective enumerations
368 #define HOBBES_ENUM_CTOR(n, v) n = v,
369 #define HOBBES_ENUM_METAENT(n, v) r.push_back(MetaEnt(#n, v));
370 
371 #define DEFINE_ENUM(T, CTORS...) \
372  struct T { \
373  enum Enum : unsigned int { \
374  _HOBPP_MAP(HOBBES_ENUM_CTOR, CTORS) \
375  }; \
376  explicit operator bool() const = delete; \
377  \
378  typedef void is_hobbes_enum; \
379  typedef std::pair<std::string, unsigned int> MetaEnt; \
380  typedef std::vector<MetaEnt> MetaSeq; \
381  \
382  static MetaSeq meta() { \
383  MetaSeq r; \
384  _HOBPP_MAP(HOBBES_ENUM_METAENT, CTORS) \
385  return r; \
386  } \
387  \
388  Enum value; \
389  operator Enum() const { \
390  return this->value; \
391  } \
392  T& operator=(Enum x) { \
393  this->value = x; \
394  return *this; \
395  } \
396  T() : value(Enum()) { } \
397  T(const T& x) : value(x.value) { } \
398  T(Enum x) : value(x) { } \
399  }
400 
401 template <typename T>
402  struct liftEnum {
404  Variant::Members vms;
405 
406  typedef typename T::MetaSeq MS;
407  MS ms = T::meta();
408  for (typename MS::const_iterator m = ms.begin(); m != ms.end(); ++m) {
409  vms.push_back(Variant::Member(m->first, Prim::make("unit"), (unsigned int)(m->second)));
410  }
411 
412  return Variant::make(vms);
413  }
414  };
415 
416 template <typename T>
417  struct lift<T, true, typename T::is_hobbes_enum> : public liftEnum<T> { };
418 template <typename T>
419  struct lift<T*, false, typename T::is_hobbes_enum> : public liftEnum<T> { };
420 
421 // allow basic reflective structs
422 #define HOBBES_STRUCT_FIELD(t, n) t n;
423 #define HOBBES_META_FIELD(t, n) r.push_back(::hobbes::Record::Member(#n, ::hobbes::lift<t, true>::type(tenv), offsetof(SelfT, n)));
424 
425 #define DEFINE_STRUCT(T, FIELDS...) \
426  struct T { \
427  _HOBPP_MAP(HOBBES_STRUCT_FIELD, FIELDS) \
428  \
429  typedef void is_hobbes_struct; \
430  typedef T SelfT; \
431  static ::hobbes::MonoTypePtr meta(::hobbes::typedb& tenv) { \
432  ::hobbes::Record::Members r; \
433  _HOBPP_MAP(HOBBES_META_FIELD, FIELDS) \
434  return ::hobbes::Record::make(r); \
435  } \
436  }
437 
438 template <typename T>
439  struct liftStruct {
440  static MonoTypePtr type(typedb& tenv) {
441  return T::meta(tenv);
442  }
443  };
444 
445 template <typename T>
446  struct lift<T, true, typename T::is_hobbes_struct> : public liftStruct<T> { };
447 template <typename T>
448  struct lift<T*, false, typename T::is_hobbes_struct> : public liftStruct<T> { };
449 
450 // perhaps some lifts might depend on their C++ values
451 template <typename T>
452  struct liftValue {
453  static MonoTypePtr type(typedb& tenv, T) {
454  return lift<T>::type(tenv);
455  }
456  };
457 
458 }
459 
460 #endif
461 
std::shared_ptr< PolyType > PolyTypePtr
Definition: type.H:23
T type
Definition: tylift.H:318
seq(const T &x, seq< T > *xs)
Definition: tylift.H:105
nulltypedb nulltdb
Definition: type.C:2239
variant< unit, pair_t > rep_t
Definition: tylift.H:101
static MonoTypePtr make(const std::string &, const MonoTypePtr &t=MonoTypePtr())
Definition: type.C:613
Definition: tylift.H:439
Definition: tylift.H:115
const bool unit
Definition: data.C:8
bool empty() const
Definition: tylift.H:107
static void accum(MonoTypes *, typedb &)
Definition: tylift.H:274
Definition: tylift.H:327
std::vector< Member > Members
Definition: type.H:385
virtual bool isTypeName(const std::string &) const =0
MonoTypePtr arrayty(const MonoTypePtr &ty, size_t n)
Definition: type.H:1155
static MonoTypePtr make(const MonoTypePtr &)
Definition: type.C:747
static void constructors(typedb &tenv, Variant::Members *ms)
Definition: tylift.H:332
unsigned int payloadSize() const
Definition: type.C:993
typeAlias()
Definition: tylift.H:65
MonoTypePtr prim()
Definition: tylift.H:232
Definition: tylift.H:71
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:150
Definition: tylift.H:22
virtual PolyTypePtr generalize(const MonoTypePtr &mt) const =0
virtual PolyTypePtr opaquePtrPolyType(const std::type_info &, unsigned int sz, bool inStruct)=0
static MonoTypePtr type()
Definition: tylift.H:119
MonoTypePtr primty(const char *x)
Definition: type.H:1008
Definition: tylift.H:339
Definition: tylift.H:149
virtual MonoTypePtr defineNamedType(const std::string &name, const str::seq &argNames, const MonoTypePtr &ty)=0
static MonoTypePtr type(typedb &)
Definition: tylift.H:143
std::vector< R > second(const std::vector< std::pair< L, R > > &xs)
Definition: array.H:228
Definition: pattern.H:281
std::pair< std::string, std::string > pair
Definition: str.H:220
T value
Definition: tylift.H:72
Definition: type.H:373
void * value
Definition: tylift.H:75
static MonoTypePtr type(typedb &)
Definition: tylift.H:403
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:440
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:162
std::string from(const T &x)
Definition: str.H:101
unsigned int size() const
Definition: type.C:1003
Definition: tylift.H:252
Definition: boot.H:7
Definition: tylift.H:317
Definition: type.H:425
static std::string name()
Definition: tylift.H:314
long size
Definition: tylift.H:84
llvm::Value * offset(llvm::IRBuilder<> *b, llvm::Value *p, llvm::Value *o0)
Definition: llvm.H:419
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:130
static void constructors(typedb &, Variant::Members *)
Definition: tylift.H:328
static MonoTypePtr make(const std::string &, const MonoTypePtr &)
Definition: type.C:1431
static std::string labelText(int idx)
Definition: tylift.H:324
MonoType::ptr MonoTypePtr
Definition: type.H:71
static MonoTypePtr make(const std::string &nm, unsigned int sz, bool scontig=false)
Definition: type.C:628
std::pair< T, seq< T > * > pair_t
Definition: tylift.H:100
static MonoTypePtr type(typedb &tenv, T)
Definition: tylift.H:453
virtual MonoTypePtr namedTypeRepresentation(const std::string &) const =0
const pair_t * head() const
Definition: tylift.H:108
Definition: tylift.H:63
static MonoTypePtr type(typedb &)
Definition: tylift.H:172
seq()
Definition: tylift.H:104
unsigned int payloadOffset() const
Definition: type.C:985
Definition: tylift.H:402
MonoTypePtr functy(const MonoTypePtr &aty, const MonoTypePtr &rty)
Definition: type.H:1109
static MonoTypePtr type(typedb &)
Definition: tylift.H:123
Definition: tylift.H:273
HOBBES_LIFT_PRIMITIVE(void, unit)
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:342
std::string show(const Expr &e)
Definition: expr.C:19
array< T > * ptr
Definition: tylift.H:82
Definition: tylift.H:99
const T * end(const array< T > *d)
Definition: tylift.H:88
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:253
static MonoTypes liftSeq(typedb &tenv)
Definition: tylift.H:283
virtual MonoTypePtr replaceTypeAliases(const MonoTypePtr &ty) const =0
std::vector< T > list()
Definition: array.H:25
const T * begin(const array< T > *d)
Definition: tylift.H:87
MonoTypePtr tvar(const std::string &vn)
Definition: type.H:1060
Definition: tylift.H:41
Definition: tylift.H:81
size_t r(const reader::MetaData &md, size_t o, T *t)
Definition: storage.H:1730
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:198
Definition: variant.H:165
std::vector< std::string > seq
Definition: str.H:19
rep_t data
Definition: tylift.H:102
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:244
static std::string labelText(int idx)
Definition: tylift.H:319
Definition: tylift.H:123
static MonoTypePtr make(const Members &ms)
Definition: type.C:1037
Definition: type.H:375
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:180
Definition: tylift.H:287
static MonoTypePtr type(typedb &)
Definition: tylift.H:145
Definition: tylift.H:179
static MonoTypePtr make(const Members &)
Definition: type.C:760
recursion(void *x)
Definition: tylift.H:76
uint32_t result
Definition: regex.C:376
T type
Definition: tylift.H:311
typeAlias(const T &v)
Definition: tylift.H:64
T data[1]
Definition: tylift.H:85
std::vector< Member > Members
Definition: type.H:435
static void accum(MonoTypes *r, typedb &tenv)
Definition: tylift.H:279
virtual MonoTypePtr opaquePtrMonoType(const std::type_info &, unsigned int sz, bool inStruct)=0
label< TN, T >::type type
Definition: tylift.H:323
Definition: tylift.H:197
Definition: tylift.H:310
virtual void defineTypeAlias(const std::string &name, const str::seq &argNames, const MonoTypePtr &ty)=0
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:136
virtual bool isTypeAliasName(const std::string &name) const =0
std::map< std::string, llvm::Value * > Args
Definition: dfa.C:1276
std::vector< MonoTypePtr > MonoTypes
Definition: type.H:72
Definition: tylift.H:118
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:237
std::vector< L > first(const std::vector< std::pair< L, R > > &xs)
Definition: array.H:208
MonoTypePtr tuple(const MonoTypes &mtys=MonoTypes())
Definition: type.H:1068
Definition: tylift.H:452
static MonoTypePtr type()
Definition: tylift.H:120
LexicalAnnotation m(const YYLTYPE &p)
Definition: hexpr.parse.C:127
T value
Definition: tylift.H:66
static MonoTypePtr type(typedb &tenv)
Definition: tylift.H:291
static MonoTypes liftSeq(typedb &)
Definition: tylift.H:275
T value
Definition: tylift.H:312
Definition: tylift.H:161
Definition: tylift.H:74
label(const T &x)
Definition: tylift.H:313