atlas  0.6
axis-types.h
Go to the documentation of this file.
1 /*1:*/
2 #line 37 "axis-types.w"
3 #ifndef AXIS_TYPES_H
4 #define AXIS_TYPES_H/*3:*/
5 #line 109 "axis-types.w"
6 #include <memory>
7 #include "sl_list.h" /*:3*//*48:*/
8 #line 1211 "axis-types.w"
9 #include <iostream> /*:48*//*52:*/
10 #line 1292 "axis-types.w"
11 #include <vector>
12 #include <cassert>/*:52*//*60:*/
13 #line 1448 "axis-types.w"
14 #include <iterator>/*:60*//*92:*/
15 #line 2304 "axis-types.w"
16 #include <stdexcept>/*:92*//*100:*/
17 #line 2465 "axis-types.w"
18 #include <csignal>/*:100*/
19 #line 40 "axis-types.w"
20 
21 namespace atlas{namespace interpreter{/*4:*/
22 #line 159 "axis-types.w"
23 struct type_expr;
24 typedef type_expr*type_p;
25 typedef const type_expr*const_type_p;
26 typedef std::unique_ptr<type_expr>type_ptr;/*:4*//*5:*/
27 #line 177 "axis-types.w"
33 #line 246 "axis-types.w"
36 
39 ,/*104:*/
40 #line 2504 "axis-types.w"
45 #line 251 "axis-types.w"
46 
47 nr_of_primitive_types};/*:10*//*15:*/
48 #line 403 "axis-types.w"
49 struct func_type;/*13:*/
50 #line 313 "axis-types.w"
51 struct type_expr
53 union
56 raw_type_list tupple;
58 };/*14:*/
59 #line 364 "axis-types.w"
60 type_expr()noexcept:kind(undetermined_type){}
61 explicit type_expr(primitive_tag p)noexcept
63 explicit type_expr(type_ptr&&c)noexcept
64 :kind(row_type),component_type(c.release()){}
65 explicit type_expr(type_list&&l)noexcept;
66 explicit type_expr(dressed_type_list&&l)noexcept;
67 inline type_expr(type_expr&&arg,type_expr&&result)noexcept;
68 
69 
70 #ifdef incompletecpp11
71 type_expr(const type_expr&t)=delete;
72 type_expr&operator=(const type_expr&t)=delete;
73 #endif
74 type_expr(type_expr&&t)noexcept;
75 type_expr&operator=(type_expr&&t)noexcept;
76 void clear()noexcept;
77 
78 ~type_expr()noexcept{clear();}
79 
80 void swap(type_expr&t)noexcept;
81 
82 type_expr copy()const;
83 void set_from(type_expr&&p)noexcept;
84 bool specialise(const type_expr&pattern);
85 
86 bool can_specialise(const type_expr&pattern)const;/*:14*/
87 #line 322 "axis-types.w"
88 
89 };/*:13*//*:15*//*27:*/
90 #line 698 "axis-types.w"
91 struct func_type
93 
95 :arg_type(std::move(a)),result_type(std::move(r)){}
96 #ifdef incompletecpp11
97 func_type(const func_type&f)=delete;
98 func_type&operator=(const func_type&f)=delete;
100 :arg_type(std::move(f.arg_type)),result_type(std::move(f.result_type))
101 {}
103 {arg_type=std::move(f.arg_type);result_type=std::move(f.result_type);
104 return*this;
105 }
106 #else
107 func_type(func_type&&f)=default;
108 func_type&operator=(func_type&&f)=default;
109 #endif
111 {return func_type(arg_type.copy(),result_type.copy());}
112 };
114 typedef std::unique_ptr<func_type>func_type_ptr;/*:27*//*49:*/
115 #line 1257 "axis-types.w"
118 virtual~value_base()=0;
119 virtual void print(std::ostream&out)const=0;
120 virtual value_base*clone()const{assert(false);return nullptr;}
121 static const char*name();
122 protected:
123 value_base(const value_base&x)=default;
124 public:
125 value_base&operator=(const value_base&x)=delete;
126 };
128 
130 typedef std::shared_ptr<const value_base>shared_value;
131 typedef std::shared_ptr<value_base>own_value;/*:49*//*53:*/
132 #line 1317 "axis-types.w"
133 struct row_value:public value_base
134 {std::vector<shared_value>val;
135 
136 explicit row_value(size_t n):val(n){}
137 template<typename I>row_value(I begin,I end):val(begin,end)
138 {}
139 void print(std::ostream&out)const;
140 size_t length()const{return val.size();}
141 row_value*clone()const{return new row_value(*this);}
142 
143 static const char*name(){return "row value";}
144 protected:
145 row_value(const row_value&v):val(v.val){}
146 
147 };
148 
149 typedef std::shared_ptr<const row_value>shared_row;
150 typedef std::shared_ptr<row_value>own_row;/*:53*//*55:*/
151 #line 1357 "axis-types.w"
152 struct tuple_value:public row_value
153 {tuple_value(size_t n):row_value(n){}
154 template<typename I>tuple_value(I begin,I end):row_value(begin,end){}
155 tuple_value*clone()const{return new tuple_value(*this);}
156 void print(std::ostream&out)const;
157 static const char*name(){return "tuple value";}
158 private:
160 
161 };
162 
163 typedef std::unique_ptr<tuple_value>tuple_ptr;
164 typedef std::shared_ptr<const tuple_value>shared_tuple;
165 typedef std::shared_ptr<tuple_value>own_tuple;/*:55*//*61:*/
166 #line 1460 "axis-types.w"
167 typedef std::shared_ptr<class evaluation_context>shared_context;
169 {shared_context next;
170 std::vector<shared_value>frame;
172 
173 public:
174 evaluation_context(const shared_context&next)
175 :next(next),frame(){}
176 void reserve(size_t n){frame.reserve(n);}
177 shared_value&elem(size_t i,size_t j);
178 std::back_insert_iterator<std::vector<shared_value> >back_inserter()
179 {return std::back_inserter(frame);}
180 const shared_context&tail()const{return next;}
181 std::vector<shared_value>::const_iterator begin()const
182 {return frame.begin();}
183 std::vector<shared_value>::const_iterator end()const
184 {return frame.end();}
185 };/*:61*//*63:*/
186 #line 1514 "axis-types.w"
188 {enum level{no_value,single_value,multi_value};
189 
191 expression_base(const expression_base&)=delete;
196 
197 virtual void evaluate(level l)const=0;
198 virtual void print(std::ostream&out)const=0;
199 
200 void void_eval()const{evaluate(no_value);}
201 void eval()const{evaluate(single_value);}
202 void multi_eval()const{evaluate(multi_value);}
203 };
204 
206 typedef std::unique_ptr<expression_base>expression_ptr;
207 typedef std::shared_ptr<expression_base>shared_expression;/*:63*//*76:*/
208 #line 1833 "axis-types.w"
210 {typedef void(*conv_f)();
211 conv_f convert;
213 conversion_info(const char*s,conv_f c):convert(c),name(s){}
214 };
215 
218 expression_ptr exp;
219 public:
220 conversion(const conversion_info&t,expression_ptr e)
221 :type(t),exp(std::move(e)){}
222 virtual void evaluate(level l)const;
223 virtual void print(std::ostream&out)const;
224 };/*:76*//*79:*/
225 #line 1910 "axis-types.w"
227 {const type_expr*from,*to;
228 
229 conversion_record(const type_expr&from_type,
230 const type_expr&to_type,
231 const char*s,conv_f c)
232 :conversion_info(s,c),from(&from_type),to(&to_type){}
233 };/*:79*//*82:*/
234 #line 1967 "axis-types.w"
236 {expression_ptr exp;
237 public:
238 voiding(expression_ptr e):exp(e.release()){}
239 virtual void evaluate(level l)const;
240 virtual void print(std::ostream&out)const;
241 };/*:82*//*93:*/
242 #line 2315 "axis-types.w"
243 struct error_base:public std::exception
245 explicit error_base(const std::string&s):message(s){}
246 #ifdef incompletecpp11
247 ~error_base()throw(){}
248 #endif
249 const char*what()const throw(){return message.c_str();}
250 };/*:93*//*94:*/
251 #line 2333 "axis-types.w"
252 struct logic_error:public error_base
253 {explicit logic_error(const std::string&s):error_base(s){}
254 #ifdef incompletecpp11
255 ~logic_error()throw(){}
256 #endif
257 };
258 
260 {explicit program_error(const std::string&s):error_base(s){}
261 #ifdef incompletecpp11
262 ~program_error()throw(){}
263 #endif
264 };
265 
267 {explicit runtime_error(const std::string&s):error_base(s){}
268 #ifdef incompletecpp11
269 ~runtime_error()throw(){}
270 #endif
271 };/*:94*//*95:*/
272 #line 2373 "axis-types.w"
273 struct expr;
275 {const expr&offender;
276 
277 expr_error(const expr&e,const std::string&s)throw()
278 :program_error(s),offender(e){}
279 #ifdef incompletecpp11
280 ~expr_error()throw(){}
281 #endif
282 };/*:95*//*96:*/
283 #line 2392 "axis-types.w"
284 struct type_error:public expr_error
287 
288 type_error(const expr&e,type_expr&&a,type_expr&&r)noexcept
289 :expr_error(e,"Type error")
290 ,actual(std::move(a)),required(std::move(r)){}
291 #ifdef incompletecpp11
293 :expr_error(std::move(e))
294 ,actual(std::move(e.actual)),required(std::move(e.required)){}
295 ~type_error()throw(){}
296 #else
297 type_error(type_error&&e)=default;
298 #endif
299 };/*:96*//*97:*/
300 #line 2416 "axis-types.w"
304 :expr_error(e,"No common type found"),variants(){}
305 };/*:97*//*98:*/
306 #line 2433 "axis-types.w"
307 struct loop_break:private logic_error
308 {unsigned depth;
310 :logic_error("Uncaught break from loop"),depth(n){}
311 #ifdef incompletecpp11
312 ~loop_break()throw(){}
313 #endif
314 };/*:98*//*99:*/
315 #line 2449 "axis-types.w"
317 {shared_value val;
318 function_return(shared_value&&val)
319 :logic_error("Uncaught return from function"),val(val){}
320 #ifdef incompletecpp11
321 ~function_return()throw(){}
322 #endif
323 };/*:99*//*103:*/
324 #line 2486 "axis-types.w"
326 user_interrupt():error_base("User interrupt"){}
327 #ifdef incompletecpp11
328 ~user_interrupt()throw(){}
329 #endif
330 };/*:103*//*11:*/
331 #line 259 "axis-types.w"
332 extern const char*prim_names[];/*:11*//*41:*/
333 #line 1088 "axis-types.w"
334 extern const type_expr unknown_type;
335 extern const type_expr void_type;
336 extern const type_expr int_type;
337 extern const type_expr bool_type;
338 extern const type_expr row_of_type;
339 extern const type_expr gen_func_type;/*:41*//*44:*/
340 #line 1133 "axis-types.w"
341 extern const type_expr rat_type;
342 extern const type_expr str_type;
343 extern const type_expr vec_type;
344 extern const type_expr ratvec_type;
345 extern const type_expr mat_type;
350 extern const type_expr pair_type;
351 extern const type_expr int_int_type;
353 extern const type_expr rd_type;
354 extern const type_expr ic_type;
355 extern const type_expr rf_type;
356 extern const type_expr split_type;
357 extern const type_expr param_type;
358 extern const type_expr param_pol_type;/*:44*//*65:*/
359 #line 1565 "axis-types.w"
360 extern std::vector<shared_value>execution_stack;/*:65*//*101:*/
361 #line 2472 "axis-types.w"
362 extern volatile std::sig_atomic_t interrupt_flag;/*:101*//*6:*/
363 #line 192 "axis-types.w"
364 type_ptr acquire(const type_expr*t);/*:6*//*8:*/
365 #line 213 "axis-types.w"
366 type_list empty_tuple();
367 type_list&prefix(type_expr&&t,type_list&dst);
368 dressed_type_list&prefix(type_expr&&t,dressed_type_list&dst);/*:8*//*28:*/
369 #line 731 "axis-types.w"
370 std::ostream&operator<<(std::ostream&out,const type_expr&t);
371 std::ostream&operator<<(std::ostream&out,const func_type&f);/*:28*//*30:*/
372 #line 785 "axis-types.w"
373 bool operator==(const type_expr&x,const type_expr&y);
374 inline bool operator!=(const type_expr&x,const type_expr&y)
375 {return!(x==y);}/*:30*//*33:*/
376 #line 844 "axis-types.w"
377 type_ptr mk_prim_type(primitive_tag p);
378 type_ptr mk_row_type(type_ptr&&c);
379 type_ptr mk_tuple_type(type_list&&l);
380 type_ptr mk_function_type(type_expr&&a,type_expr&&r);
381 
382 type_p make_prim_type(unsigned int p);
383 type_p make_row_type(type_p c);
384 type_p make_tuple_type(raw_type_list l);
385 type_p make_function_type(type_p a,type_p r);
386 
387 raw_type_list make_type_singleton(type_p raw);
388 raw_type_list make_type_list(raw_type_list l,type_p t);/*:33*//*35:*/
389 #line 930 "axis-types.w"
390 type_ptr mk_type(const char*s);
391 type_expr mk_type_expr(const char*s);/*:35*//*46:*/
392 #line 1185 "axis-types.w"
393 type_expr unknown_tuple(size_t n);/*:46*//*50:*/
394 #line 1278 "axis-types.w"
395 std::ostream&operator<<(std::ostream&out,const value_base&v);/*:50*//*57:*/
396 #line 1391 "axis-types.w"
397 void push_tuple_components();
398 void wrap_tuple(size_t n);/*:57*//*64:*/
399 #line 1540 "axis-types.w"
400 inline std::ostream&operator<<(std::ostream&out,const expression_base&e)
401 {e.print(out);return out;}/*:64*//*67:*/
402 #line 1581 "axis-types.w"
403 void push_expanded(expression_base::level l,const shared_value&v);/*:67*//*75:*/
404 #line 1810 "axis-types.w"
405 bool coerce(const type_expr&from_type,const type_expr&to_type,
406 expression_ptr&e);
407 expression_ptr conform_types
408 (const type_expr&found,type_expr&required
409 ,expression_ptr&&d,const expr&e);
410 const conversion_record*row_coercion(const type_expr&final_type,
412 void coercion(const type_expr&from,
413 const type_expr&to,
414 const char*s,conversion_info::conv_f f);/*:75*//*87:*/
415 #line 2126 "axis-types.w"
416 unsigned int is_close(const type_expr&x,const type_expr&y);/*:87*//*90:*/
417 #line 2244 "axis-types.w"
418 bool broader_eq(const type_expr&a,const type_expr&b);/*:90*//*26:*/
419 #line 675 "axis-types.w"
421 :kind(function_type)
422 ,func(new func_type(std::move(arg),std::move(result)))
423 {}/*:26*//*42:*/
424 #line 1103 "axis-types.w"
425 template<typename T>T&as_lvalue(T&&rvalue){return rvalue;}/*:42*//*69:*/
426 #line 1634 "axis-types.w"
427 inline void push_value(const shared_value&v)
428 {execution_stack.push_back(v);}
429 
430 inline void push_value(shared_value&&v)
431 {execution_stack.push_back(std::move(v));}/*:69*//*70:*/
432 #line 1648 "axis-types.w"
433 inline shared_value pop_value()
434 {shared_value arg(std::move(execution_stack.back()));
435 execution_stack.pop_back();
436 return arg;
437 }/*:70*//*71:*/
438 #line 1667 "axis-types.w"
439 template<typename D>
440 inline std::shared_ptr<const D>get()throw(logic_error)
441 {std::shared_ptr<const D>p=std::dynamic_pointer_cast<const D>(pop_value());
442 if(p.get()==nullptr)
443 throw logic_error(std::string("Argument is no ")+D::name());
444 return p;
445 }
446 
447 
448 
449 template<typename D>
450 inline std::shared_ptr<D>non_const_get()throw(logic_error)
451 {return std::const_pointer_cast<D>(get<D>());}/*:71*//*72:*/
452 #line 1698 "axis-types.w"
453 template<typename D>
454 D*force(value v)throw(logic_error)
455 {D*p=dynamic_cast<D* >(v);
456 if(p==nullptr)throw
457 logic_error(std::string("forced value is no ")+D::name());
458 return p;
459 }
460 
461 template<typename D>
462 const D*force(const value_base*v)throw(logic_error)
463 {const D*p=dynamic_cast<const D* >(v);
464 if(p==nullptr)throw
465 logic_error(std::string("forced value is no ")+D::name());
466 return p;
467 }/*:72*//*73:*/
468 #line 1741 "axis-types.w"
469 template<typename D>
470 std::shared_ptr<D>get_own()throw(logic_error)
471 {std::shared_ptr<const D>p=get<D>();
472 if(p.unique())
473 return std::const_pointer_cast<D>(p);
474 return std::shared_ptr<D>(p->clone());
475 }
476 
477 inline value uniquify(shared_value&v)
478 {if(not v.unique())
479 v=shared_value(v->clone());
480 return const_cast<value>(v.get());
481 }/*:73*//*74:*/
482 #line 1761 "axis-types.w"
483 template<unsigned int>void wrap_tuple();
484 template<unsigned int>
485 void do_wrap(std::vector<shared_value>::iterator it);
486 template< >
487 inline void do_wrap<0u>(std::vector<shared_value>::iterator it){}
488 template<unsigned int n>
489 inline void do_wrap(std::vector<shared_value>::iterator it)
490 {* --it=pop_value();do_wrap<n-1>(it);}
491 template<unsigned int n>
492 inline void wrap_tuple()
493 {std::shared_ptr<tuple_value>result=std::make_shared<tuple_value>(n);
494 do_wrap<n>(result->val.end());
495 push_value(std::move(result));
496 }/*:74*/
497 #line 45 "axis-types.w"
498 
499 }}
500 #endif/*:1*/
Definition: axis-types.h:44
const type_expr rd_type(root_datum_type)
Definition: axis-types.h:353
void push_expanded(expression_base::level l, const shared_value &v)
Definition: axis-types.cpp:447
void eval() const
Definition: axis-types.h:201
value_base()
Definition: axis-types.h:117
void swap(type_expr &t) noexcept
Definition: axis-types.cpp:143
std::shared_ptr< D > get_own()
Definition: axis-types.h:470
type_ptr mk_row_type(type_ptr &&c)
Definition: axis-types.cpp:289
func_type copy() const
Definition: axis-types.h:110
bool specialise(const type_expr &pattern)
Definition: axis-types.cpp:161
volatile std::sig_atomic_t interrupt_flag
Definition: axis-types.cpp:53
const type_expr gen_func_type(mk_type_expr("(*->*)"))
Definition: axis-types.h:339
Definition: axis-types.h:43
bool coerce(const type_expr &from_type, const type_expr &to_type, expression_ptr &e)
Definition: axis-types.cpp:484
bool operator!=(const type_expr &x, const type_expr &y)
Definition: axis-types.h:374
loop_break(int n)
Definition: axis-types.h:309
expression_base * expression
Definition: axis-types.h:205
const conversion_info & type
Definition: axis-types.h:217
std::ostream & operator<<(std::ostream &out, const raw_type_list &l)
Definition: axis-types.cpp:218
Definition: axis-types.h:38
Definition: axis-types.h:42
expression_ptr exp
Definition: axis-types.h:218
const char * what() const
Definition: axis-types.h:249
type_expr() noexcept
Definition: axis-types.h:60
uA p
Definition: lists.cpp:26
~type_expr() noexcept
Definition: axis-types.h:78
bool can_specialise(const type_expr &pattern) const
Definition: axis-types.cpp:189
type_p make_prim_type(unsigned int p)
Definition: axis-types.cpp:299
error_base(const std::string &s)
Definition: axis-types.h:245
conversion_info(const char *s, conv_f c)
Definition: axis-types.h:213
Definition: axis-types.h:35
std::vector< shared_value > frame
Definition: axis-types.h:170
Definition: axis-types.h:216
std::vector< shared_value > execution_stack
Definition: axis-types.cpp:49
type_ptr mk_type(const char *s)
Definition: axis-types.cpp:388
const id_pat & pattern
Definition: axis.cpp:21
const type_expr ic_type(inner_class_type)
Definition: axis-types.h:354
std::shared_ptr< tuple_value > own_tuple
Definition: axis-types.h:165
Definition: axis-types.h:307
Definition: axis-types.h:316
Definition: axis-types.h:38
Definition: axis-types.h:116
std::string name
Definition: axis-types.h:212
std::shared_ptr< row_value > own_row
Definition: axis-types.h:150
value_base * value
Definition: axis-types.h:129
expression_base()
Definition: axis-types.h:190
void coercion(const type_expr &from, const type_expr &to, const char *s, conversion_info::conv_f f)
Definition: axis-types.cpp:470
const type_expr row_of_type(mk_type_expr("[*]"))
Definition: axis-types.h:338
containers::weak_sl_list_const_iterator< type_expr > wtl_const_iterator
Definition: axis-types.h:31
const type_expr * to
Definition: axis-types.h:227
Definition: axis-types.h:152
void do_wrap< 0u >(std::vector< shared_value >::iterator it)
Definition: axis-types.h:487
shared_value pop_value()
Definition: axis-types.h:433
const type_expr Lie_type_type(complex_lie_type_type)
Definition: axis-types.h:352
user_interrupt()
Definition: axis-types.h:326
void set_from(type_expr &&p) noexcept
Definition: axis-types.cpp:108
Definition: axis-types.h:133
Definition: axis-types.h:168
size_t length() const
Definition: axis-types.h:140
Definition: axis-types.h:38
virtual ~value_base()=0
Definition: axis-types.h:127
std::unique_ptr< expression_base > expression_ptr
Definition: axis-types.h:206
raw_type_list make_type_singleton(type_p t)
Definition: axis-types.cpp:316
type_expr arg_type
Definition: axis-types.h:92
std::vector< shared_value >::const_iterator end() const
Definition: axis-types.h:183
const conversion_record * row_coercion(const type_expr &final_type, type_expr &component_type)
Definition: axis-types.cpp:505
virtual value_base * clone() const
Definition: axis-types.h:120
const type_expr param_type(module_parameter_type)
Definition: axis-types.h:357
function_return(shared_value &&val)
Definition: axis-types.h:318
std::shared_ptr< const row_value > shared_row
Definition: axis-types.h:149
Definition: axis-types.h:35
Definition: axis-types.h:35
Definition: axis-types.h:274
bool broader_eq(const type_expr &a, const type_expr &b)
Definition: axis-types.cpp:543
static const char * name()
Definition: axis-types.h:143
balance_error(const expr &e)
Definition: axis-types.h:303
tuple_value(size_t n)
Definition: axis-types.h:153
type_expr required
Definition: axis-types.h:286
std::back_insert_iterator< std::vector< shared_value > > back_inserter()
Definition: axis-types.h:178
logic_error(const std::string &s)
Definition: axis-types.h:253
Definition: axis-types.h:325
containers::weak_sl_list_iterator< type_expr > wtl_iterator
Definition: axis-types.h:32
std::unique_ptr< func_type > func_type_ptr
Definition: axis-types.h:114
void multi_eval() const
Definition: axis-types.h:202
const type_expr void_type(empty_tuple())
Definition: axis-types.h:335
std::shared_ptr< value_base > own_value
Definition: axis-types.h:131
value uniquify(shared_value &v)
Definition: axis-types.h:477
Definition: sl_list.h:30
const type_expr vec_type(vector_type)
Definition: axis-types.h:343
tuple_value(I begin, I end)
Definition: axis-types.h:154
const expr & offender
Definition: axis-types.h:275
Definition: axis-types.h:187
std::vector< shared_value > val
Definition: axis-types.h:134
virtual ~expression_base()
Definition: axis-types.h:195
primitive_tag
Definition: axis-types.h:37
Definition: axis-types.h:51
type_expr & operator=(type_expr &&t) noexcept
Definition: axis-types.cpp:135
const type_expr row_row_of_int_type(mk_type_expr("[[int]]"))
Definition: axis-types.h:349
func_type * func
Definition: axis-types.h:57
Definition: axis-types.h:43
Definition: axis-types.h:226
program_error(const std::string &s)
Definition: axis-types.h:260
func_type * func_type_p
Definition: axis-types.h:113
Definition: axis-types.h:35
Definition: axis-types.h:41
type_ptr mk_prim_type(primitive_tag p)
Definition: axis-types.cpp:283
type_ptr acquire(const type_expr *t)
Definition: axis-types.cpp:55
void(* conv_f)()
Definition: axis-types.h:210
row_value(size_t n)
Definition: axis-types.h:136
Definition: axis-types.h:266
Definition: axis-types.h:91
const type_expr unknown_type
Definition: axis-types.cpp:23
void push_value(const shared_value &v)
Definition: axis-types.h:427
std::shared_ptr< D > non_const_get()
Definition: axis-types.h:450
type_ptr mk_function_type(type_expr &&a, type_expr &&r)
Definition: axis-types.cpp:295
containers::sl_list< type_expr > variants
Definition: axis-types.h:302
type_list & prefix(type_expr &&t, type_list &dst)
Definition: axis-types.cpp:60
type_error(const expr &e, type_expr &&a, type_expr &&r) noexcept
Definition: axis-types.h:288
Definition: axis-types.h:44
const type_expr str_type(string_type)
Definition: axis-types.h:342
Definition: axis-types.h:41
void push_tuple_components()
Definition: axis-types.cpp:426
type_expr actual
Definition: axis-types.h:285
type_list empty_tuple()
Definition: axis-types.cpp:58
containers::simple_list< type_expr > type_list
Definition: axis-types.h:28
Definition: sl_list.h:28
D * force(value v)
Definition: axis-types.h:454
std::shared_ptr< const tuple_value > shared_tuple
Definition: axis-types.h:164
#define out(c)
Definition: cweave.c:205
conv_f convert
Definition: axis-types.h:211
Definition: axis-types.h:43
row_value * clone() const
Definition: axis-types.h:141
const type_expr bool_type(boolean_type)
Definition: axis-types.h:337
Definition: axis-types.h:42
const type_expr split_type(split_integer_type)
Definition: axis-types.h:356
unsigned depth
Definition: axis-types.h:308
raw_type_list make_type_list(raw_type_list l, type_p t)
Definition: axis-types.cpp:322
const type_expr param_pol_type(virtual_module_type)
Definition: axis-types.h:358
containers::sl_list< type_expr > dressed_type_list
Definition: axis-types.h:30
type_p make_tuple_type(raw_type_list l)
Definition: axis-types.cpp:305
atlas::containers::sl_node< type_expr > * raw_type_list
Definition: axis-types.h:29
void reserve(size_t n)
Definition: axis-types.h:176
type_expr * type_p
Definition: axis-types.h:23
Definition: axis-types.h:284
const type_expr row_of_int_type(mk_type_expr("[int]"))
Definition: axis-types.h:346
std::shared_ptr< expression_base > shared_expression
Definition: axis-types.h:207
type_expr copy() const
Definition: axis-types.cpp:74
const char * prim_names[]
Definition: axis-types.cpp:11
static const char * name()
Definition: axis-types.h:157
primitive_tag prim
Definition: axis-types.h:54
const shared_context & tail() const
Definition: axis-types.h:180
type_tag
Definition: axis-types.h:34
virtual void print(std::ostream &out) const =0
type_expr mk_type_expr(const char *s)
Definition: axis-types.cpp:376
const type_expr rat_type(rational_type)
Definition: axis-types.h:341
const type_expr mat_type(matrix_type)
Definition: axis-types.h:345
conversion(const conversion_info &t, expression_ptr e)
Definition: axis-types.h:220
Definition: axis-types.h:42
expression_ptr conform_types(const type_expr &found, type_expr &required, expression_ptr &&d, const expr &e)
Definition: axis-types.cpp:499
std::vector< shared_value >::const_iterator begin() const
Definition: axis-types.h:181
func_type(type_expr &&a, type_expr &&r)
Definition: axis-types.h:94
unsigned int is_close(const type_expr &x, const type_expr &y)
Definition: axis-types.cpp:515
runtime_error(const std::string &s)
Definition: axis-types.h:267
type_expr(primitive_tag p) noexcept
Definition: axis-types.h:61
const type_expr ratvec_type(rational_vector_type)
Definition: axis-types.h:344
const type_expr rf_type(real_form_type)
Definition: axis-types.h:355
tuple_value(const tuple_value &v)
Definition: axis-types.h:159
type_p make_row_type(type_p c)
Definition: axis-types.cpp:302
std::string message
Definition: axis-types.h:244
std::shared_ptr< class evaluation_context > shared_context
Definition: axis-types.h:167
Definition: axis-types.h:209
type_tag kind
Definition: axis-types.h:52
char * name
Definition: common.c:103
Definition: axis-types.h:41
unsigned long n
Definition: axis.cpp:77
shared_context next
Definition: axis-types.h:169
bool operator==(const type_expr &x, const type_expr &y)
Definition: axis-types.cpp:257
simple_list< T, Alloc >::const_iterator end(const simple_list< T, Alloc > &l)
Definition: sl_list.h:650
std::unique_ptr< type_expr > type_ptr
Definition: axis-types.h:26
type_expr result_type
Definition: axis-types.h:92
Definition: axis-types.h:38
Definition: Atlas.h:38
void print(char *s,...)
Definition: common.c:861
const type_expr int_int_type(mk_type_expr("(int,int)"))
Definition: axis-types.h:351
void do_wrap(std::vector< shared_value >::iterator it)
Definition: axis-types.h:489
tuple_value * clone() const
Definition: axis-types.h:155
Definition: axis-types.h:301
Definition: axis-types.h:259
expression_ptr exp
Definition: axis-types.h:236
type_ptr mk_tuple_type(type_list &&l)
Definition: axis-types.cpp:292
type_p component_type
Definition: axis-types.h:55
type_p make_function_type(type_p a, type_p r)
Definition: axis-types.cpp:310
Definition: axis-types.h:243
const type_expr * const_type_p
Definition: axis-types.h:25
type_expr unknown_tuple(size_t n)
Definition: axis-types.cpp:402
Definition: axis-types.h:235
const expr & e
Definition: axis.cpp:95
Definition: common.h:36
const type_expr row_of_rat_type(mk_type_expr("[rat]"))
Definition: axis-types.h:347
shared_value val
Definition: axis-types.h:317
const type_expr int_type(integral_type)
Definition: axis-types.h:336
Definition: cweave.c:262
raw_type_list tupple
Definition: axis-types.h:56
evaluation_context(const shared_context &next)
Definition: axis-types.h:174
Definition: parse_types.h:156
const type_expr pair_type(mk_type_expr("(*,*)"))
Definition: axis-types.h:350
void wrap_tuple(size_t n)
Definition: axis-types.cpp:432
void void_eval() const
Definition: axis-types.h:200
level
Definition: axis-types.h:188
const type_expr row_of_vec_type(mk_type_expr("[vec]"))
Definition: axis-types.h:348
T & as_lvalue(T &&rvalue)
Definition: axis-types.h:425
expr_error(const expr &e, const std::string &s)
Definition: axis-types.h:277
Definition: axis-types.h:252
void clear() noexcept
Definition: axis-types.cpp:98
row_value(const row_value &v)
Definition: axis-types.h:145
voiding(expression_ptr e)
Definition: axis-types.h:238
std::shared_ptr< const value_base > shared_value
Definition: axis-types.h:130
Vertex v
Definition: graph.cpp:116
row_value(I begin, I end)
Definition: axis-types.h:137
Definition: axis-types.h:35
conversion_record(const type_expr &from_type, const type_expr &to_type, const char *s, conv_f c)
Definition: axis-types.h:229
type_expr(type_ptr &&c) noexcept
Definition: axis-types.h:63
std::unique_ptr< tuple_value > tuple_ptr
Definition: axis-types.h:163