| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
#ifndef __CHUCK_ABSYN_H__ |
| 34 |
#define __CHUCK_ABSYN_H__ |
| 35 |
|
| 36 |
#include "chuck_def.h" |
| 37 |
#include "chuck_symbol.h" |
| 38 |
#include <stdint.h> |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
#if defined(_cplusplus) || defined(__cplusplus) |
| 44 |
extern "C" { |
| 45 |
#endif |
| 46 |
|
| 47 |
|
| 48 |
typedef int a_Pos; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
typedef enum { |
| 55 |
ae_op_none = 0, |
| 56 |
ae_op_plus, ae_op_minus, ae_op_times, ae_op_divide, |
| 57 |
ae_op_eq, ae_op_neq, ae_op_lt, ae_op_le, ae_op_gt, |
| 58 |
ae_op_ge, ae_op_and, ae_op_or, ae_op_s_or, ae_op_s_and, |
| 59 |
ae_op_shift_left, ae_op_shift_right, ae_op_percent, |
| 60 |
ae_op_s_xor, ae_op_chuck, ae_op_plus_chuck, ae_op_minus_chuck, |
| 61 |
ae_op_times_chuck, ae_op_divide_chuck, ae_op_s_and_chuck, |
| 62 |
ae_op_s_or_chuck, ae_op_s_xor_chuck, ae_op_shift_right_chuck, |
| 63 |
ae_op_shift_left_chuck, ae_op_percent_chuck, |
| 64 |
ae_op_plusplus, ae_op_minusminus, ae_op_tilda, ae_op_exclamation, |
| 65 |
ae_op_at_chuck, ae_op_unchuck, ae_op_upchuck, ae_op_downchuck, |
| 66 |
ae_op_assign, ae_op_dollar, ae_op_at_at, ae_op_coloncolon, |
| 67 |
ae_op_spork, ae_op_typeof, ae_op_sizeof, ae_op_new, |
| 68 |
ae_op_arrow_left, ae_op_arrow_right, ae_op_gruck_left, ae_op_gruck_right, |
| 69 |
ae_op_ungruck_left, ae_op_ungruck_right, |
| 70 |
|
| 71 |
ae_op_count |
| 72 |
} ae_Operator; |
| 73 |
|
| 74 |
|
| 75 |
const char * op2str( ae_Operator op ); |
| 76 |
|
| 77 |
ae_Operator str2op( const char * str ); |
| 78 |
|
| 79 |
|
| 80 |
typedef enum { |
| 81 |
ae_key_this, ae_key_me, ae_key_func, ae_key_public, ae_key_protected, |
| 82 |
ae_key_private, ae_key_static, ae_key_instance, ae_key_abstract |
| 83 |
} ae_Keyword; |
| 84 |
|
| 85 |
|
| 86 |
typedef enum |
| 87 |
{ |
| 88 |
ae_fp_unknown = 0, |
| 89 |
ae_fp_ctor, |
| 90 |
ae_fp_dtor, |
| 91 |
ae_fp_mfun, |
| 92 |
ae_fp_sfun, |
| 93 |
ae_fp_gfun, |
| 94 |
ae_fp_addr, |
| 95 |
|
| 96 |
ae_fp_count |
| 97 |
} ae_FuncPointerKind; |
| 98 |
|
| 99 |
|
| 100 |
const char * fpkind2str( ae_FuncPointerKind kind ); |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
typedef struct a_Program_ * a_Program; |
| 109 |
typedef struct a_Section_ * a_Section; |
| 110 |
typedef struct a_Stmt_List_ * a_Stmt_List; |
| 111 |
typedef struct a_Class_Def_ * a_Class_Def; |
| 112 |
typedef struct a_Func_Def_ * a_Func_Def; |
| 113 |
typedef struct a_Code_Segment_ * a_Code_Segment; |
| 114 |
typedef struct a_Stmt_ * a_Stmt; |
| 115 |
typedef struct a_Exp_ * a_Exp; |
| 116 |
typedef struct a_Exp_Chuck_ * a_Exp_Chuck; |
| 117 |
typedef struct a_Exp_Binary_ * a_Exp_Binary; |
| 118 |
typedef struct a_Exp_Cast_ * a_Exp_Cast; |
| 119 |
typedef struct a_Exp_Unary_ * a_Exp_Unary; |
| 120 |
typedef struct a_Exp_Postfix_ * a_Exp_Postfix; |
| 121 |
typedef struct a_Exp_Primary_ * a_Exp_Primary; |
| 122 |
typedef struct a_Exp_Dur_ * a_Exp_Dur; |
| 123 |
typedef struct a_Exp_Array_ * a_Exp_Array; |
| 124 |
typedef struct a_Exp_Func_Call_ * a_Exp_Func_Call; |
| 125 |
typedef struct a_Exp_Dot_Member_ * a_Exp_Dot_Member; |
| 126 |
typedef struct a_Exp_If_ * a_Exp_If; |
| 127 |
typedef struct a_Exp_Decl_ * a_Exp_Decl; |
| 128 |
typedef struct a_Exp_Hack_ * a_Exp_Hack; |
| 129 |
typedef struct a_Stmt_Code_ * a_Stmt_Code; |
| 130 |
typedef struct a_Stmt_If_ * a_Stmt_If; |
| 131 |
typedef struct a_Stmt_While_ * a_Stmt_While; |
| 132 |
typedef struct a_Stmt_Until_ * a_Stmt_Until; |
| 133 |
typedef struct a_Stmt_For_ * a_Stmt_For; |
| 134 |
typedef struct a_Stmt_ForEach_ * a_Stmt_ForEach; |
| 135 |
typedef struct a_Stmt_Loop_ * a_Stmt_Loop; |
| 136 |
typedef struct a_Stmt_Switch_ * a_Stmt_Switch; |
| 137 |
typedef struct a_Stmt_Break_ * a_Stmt_Break; |
| 138 |
typedef struct a_Stmt_Continue_ * a_Stmt_Continue; |
| 139 |
typedef struct a_Stmt_Return_ * a_Stmt_Return; |
| 140 |
typedef struct a_Stmt_Case_ * a_Stmt_Case; |
| 141 |
typedef struct a_Stmt_GotoLabel_ * a_Stmt_GotoLabel; |
| 142 |
typedef struct a_Stmt_Import_ * a_Stmt_Import; |
| 143 |
typedef struct a_Stmt_Doc_ * a_Stmt_Doc; |
| 144 |
typedef struct a_Stmt_Example_ * a_Stmt_Example; |
| 145 |
typedef struct a_Decl_ * a_Decl; |
| 146 |
typedef struct a_Var_Decl_ * a_Var_Decl; |
| 147 |
typedef struct a_Var_Decl_List_ * a_Var_Decl_List; |
| 148 |
typedef struct a_Type_Decl_ * a_Type_Decl; |
| 149 |
typedef struct a_Arg_List_ * a_Arg_List; |
| 150 |
typedef struct a_Id_List_ * a_Id_List; |
| 151 |
typedef struct a_Class_Ext_ * a_Class_Ext; |
| 152 |
typedef struct a_Class_Body_ * a_Class_Body; |
| 153 |
typedef struct a_Array_Sub_ * a_Array_Sub; |
| 154 |
typedef struct a_Ctor_Call_ * a_Ctor_Call; |
| 155 |
typedef struct a_Complex_ * a_Complex; |
| 156 |
typedef struct a_Polar_ * a_Polar; |
| 157 |
typedef struct a_Vec_ * a_Vec; |
| 158 |
typedef struct a_Import_ * a_Import; |
| 159 |
typedef struct a_Doc_ * a_Doc; |
| 160 |
typedef struct a_Example_ * a_Example; |
| 161 |
|
| 162 |
|
| 163 |
typedef struct Chuck_Type * t_CKTYPE; |
| 164 |
typedef struct Chuck_Value * t_CKVALUE; |
| 165 |
typedef struct Chuck_Func * t_CKFUNC; |
| 166 |
typedef struct Chuck_Namespace * t_CKNSPC; |
| 167 |
typedef struct Chuck_VM_Code * t_CKVMCODE; |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
a_Program new_program( a_Section section, uint32_t line, uint32_t where ); |
| 176 |
a_Program append_program( a_Program program, a_Section section, uint32_t line, uint32_t where ); |
| 177 |
a_Section new_section_stmt( a_Stmt_List stmt_list, uint32_t line, uint32_t where ); |
| 178 |
a_Section new_section_func_def( a_Func_Def func_def, uint32_t line, uint32_t where ); |
| 179 |
a_Section new_section_class_def( a_Class_Def class_def, uint32_t line, uint32_t where ); |
| 180 |
a_Stmt_List new_stmt_list( a_Stmt stmt, uint32_t line, uint32_t where ); |
| 181 |
a_Stmt_List append_stmt_list( a_Stmt_List stmt_list, a_Stmt stmt, uint32_t line, uint32_t where ); |
| 182 |
a_Stmt new_stmt_from_expression( a_Exp exp, uint32_t line, uint32_t where ); |
| 183 |
a_Stmt new_stmt_from_code( a_Stmt_List code, uint32_t line, uint32_t where ); |
| 184 |
a_Stmt new_stmt_from_while( a_Exp cond, a_Stmt body, uint32_t line, uint32_t where ); |
| 185 |
a_Stmt new_stmt_from_do_while( a_Exp cond, a_Stmt body, uint32_t line, uint32_t where ); |
| 186 |
a_Stmt new_stmt_from_until( a_Exp cond, a_Stmt body, uint32_t line, uint32_t where ); |
| 187 |
a_Stmt new_stmt_from_do_until( a_Exp cond, a_Stmt body, uint32_t line, uint32_t where ); |
| 188 |
a_Stmt new_stmt_from_for( a_Stmt c1, a_Stmt c2, a_Exp c3, a_Stmt body, uint32_t line, uint32_t where ); |
| 189 |
a_Stmt new_stmt_from_foreach( a_Exp iter, a_Exp array, a_Stmt body, uint32_t line, uint32_t where ); |
| 190 |
a_Stmt new_stmt_from_loop( a_Exp cond, a_Stmt body, uint32_t line, uint32_t where ); |
| 191 |
a_Stmt new_stmt_from_if( a_Exp cond, a_Stmt if_body, a_Stmt else_body, uint32_t line, uint32_t where ); |
| 192 |
a_Stmt new_stmt_from_switch( a_Exp exp, uint32_t line, uint32_t where ); |
| 193 |
a_Stmt new_stmt_from_break( uint32_t line, uint32_t where ); |
| 194 |
a_Stmt new_stmt_from_continue( uint32_t line, uint32_t where ); |
| 195 |
a_Stmt new_stmt_from_return( a_Exp exp, uint32_t line, uint32_t where ); |
| 196 |
a_Stmt new_stmt_from_label( c_str xid, uint32_t line, uint32_t where ); |
| 197 |
a_Stmt new_stmt_from_case( a_Exp exp, uint32_t line, uint32_t where ); |
| 198 |
a_Stmt new_stmt_from_import( a_Import target, uint32_t line, uint32_t where ); |
| 199 |
a_Stmt new_stmt_from_doc( a_Doc target, uint32_t line, uint32_t where ); |
| 200 |
a_Stmt new_stmt_from_example( a_Example target, uint32_t line, uint32_t where ); |
| 201 |
a_Exp append_expression( a_Exp list, a_Exp exp, uint32_t line, uint32_t where ); |
| 202 |
a_Exp new_exp_from_binary( a_Exp lhs, ae_Operator oper, a_Exp rhs, uint32_t line, uint32_t where ); |
| 203 |
a_Exp new_exp_from_unary( ae_Operator oper, a_Exp exp, uint32_t line, uint32_t where ); |
| 204 |
a_Exp new_exp_from_unary2( ae_Operator oper, a_Type_Decl type, int ctor_invoked, a_Exp ctor_args, a_Array_Sub array, uint32_t line, uint32_t where ); |
| 205 |
a_Exp new_exp_from_unary3( ae_Operator oper, a_Stmt code, uint32_t line, uint32_t where ); |
| 206 |
a_Exp new_exp_from_cast( a_Type_Decl type, a_Exp exp, uint32_t line, uint32_t where, uint32_t castPos ); |
| 207 |
a_Exp new_exp_from_array( a_Exp base, a_Array_Sub indices, uint32_t line, uint32_t where ); |
| 208 |
a_Exp new_exp_from_array_lit( a_Array_Sub exp_list, uint32_t line, uint32_t where ); |
| 209 |
a_Exp new_exp_from_func_call( a_Exp base, a_Exp args, uint32_t line, uint32_t where ); |
| 210 |
a_Exp new_exp_from_member_dot( a_Exp base, c_str member, uint32_t line, uint32_t where, uint32_t memberPos ); |
| 211 |
a_Exp new_exp_from_postfix( a_Exp base, ae_Operator op, uint32_t line, uint32_t where ); |
| 212 |
a_Exp new_exp_from_dur( a_Exp base, a_Exp unit, uint32_t line, uint32_t where ); |
| 213 |
a_Exp new_exp_from_id( c_str xid, uint32_t line, uint32_t where ); |
| 214 |
a_Exp new_exp_from_int( t_CKINT num, uint32_t line, uint32_t where ); |
| 215 |
a_Exp new_exp_from_float( t_CKFLOAT num, uint32_t line, uint32_t where ); |
| 216 |
a_Exp new_exp_from_str( c_str str, uint32_t line, uint32_t where ); |
| 217 |
a_Exp new_exp_from_char( c_str chr, uint32_t line, uint32_t where ); |
| 218 |
a_Exp new_exp_from_if( a_Exp cond, a_Exp lhs, a_Exp rhs, uint32_t line, uint32_t where ); |
| 219 |
a_Exp new_exp_from_complex( a_Complex, uint32_t line, uint32_t where ); |
| 220 |
a_Exp new_exp_from_polar( a_Polar, uint32_t line, uint32_t where ); |
| 221 |
a_Exp new_exp_from_vec( a_Vec, uint32_t line, uint32_t where ); |
| 222 |
a_Exp new_exp_decl_external( a_Type_Decl type_decl, a_Var_Decl_List var_decl_list, int is_static, int is_const, uint32_t line, uint32_t where ); |
| 223 |
a_Exp new_exp_decl_global( a_Type_Decl type_decl, a_Var_Decl_List var_decl_list, int is_static, int is_const, uint32_t line, uint32_t where ); |
| 224 |
a_Exp new_exp_decl( a_Type_Decl type_decl, a_Var_Decl_List var_decl_list, int is_static, int is_const, uint32_t line, uint32_t where ); |
| 225 |
a_Exp new_exp_from_hack( a_Exp exp, uint32_t line, uint32_t where ); |
| 226 |
a_Exp new_exp_from_nil( uint32_t line, uint32_t where ); |
| 227 |
a_Var_Decl_List new_var_decl_list( a_Var_Decl var_decl, uint32_t line, uint32_t where ); |
| 228 |
a_Var_Decl_List prepend_var_decl_list( a_Var_Decl var_decl, a_Var_Decl_List list, uint32_t line, uint32_t where ); |
| 229 |
a_Var_Decl new_var_decl( c_constr xid, int ctor_invoked, a_Exp ctor_args, a_Array_Sub array, uint32_t line, uint32_t where ); |
| 230 |
a_Type_Decl new_type_decl( a_Id_List xid, int ref, uint32_t line, uint32_t where ); |
| 231 |
a_Type_Decl add_type_decl_array( a_Type_Decl type_decl, a_Array_Sub array, uint32_t line, uint32_t where ); |
| 232 |
a_Arg_List new_arg_list( a_Type_Decl type_decl, a_Var_Decl var_decl, uint32_t line, uint32_t where ); |
| 233 |
a_Arg_List prepend_arg_list( a_Type_Decl type_decl, a_Var_Decl var_decl, a_Arg_List arg_list, uint32_t line, uint32_t where ); |
| 234 |
a_Array_Sub new_array_sub( a_Exp exp, uint32_t line, uint32_t where ); |
| 235 |
a_Array_Sub prepend_array_sub( a_Array_Sub array, a_Exp exp, uint32_t line, uint32_t where ); |
| 236 |
a_Complex new_complex( a_Exp re, uint32_t line, uint32_t where ); |
| 237 |
a_Polar new_polar( a_Exp mod, uint32_t line, uint32_t where ); |
| 238 |
a_Vec new_vec( a_Exp e, uint32_t line, uint32_t where ); |
| 239 |
a_Import new_import( c_str str, a_Id_List id_list, uint32_t line, uint32_t where ); |
| 240 |
a_Import prepend_import( a_Import target, a_Import list, uint32_t line, uint32_t where ); |
| 241 |
a_Doc new_doc( c_str str, uint32_t line, uint32_t where ); |
| 242 |
a_Doc prepend_doc( a_Doc target, a_Doc list, uint32_t line, uint32_t where ); |
| 243 |
a_Example new_example( c_str str, uint32_t line, uint32_t where ); |
| 244 |
a_Example prepend_example( a_Example target, a_Example list, uint32_t line, uint32_t where ); |
| 245 |
|
| 246 |
a_Class_Def new_class_def( ae_Keyword class_decl, a_Id_List xid, a_Class_Ext ext, a_Class_Body body, uint32_t line, uint32_t where ); |
| 247 |
a_Class_Body new_class_body( a_Section section, uint32_t line, uint32_t where ); |
| 248 |
a_Class_Body prepend_class_body( a_Section section, a_Class_Body body, uint32_t line, uint32_t where ); |
| 249 |
a_Class_Ext new_class_ext( a_Id_List extend_id, a_Id_List impl_list, uint32_t line, uint32_t where ); |
| 250 |
a_Class_Def new_iface_def( ae_Keyword class_decl, a_Id_List xid, a_Class_Ext ext, a_Class_Body body, uint32_t line, uint32_t where ); |
| 251 |
a_Id_List new_id_list( c_constr xid, uint32_t line, uint32_t where ); |
| 252 |
a_Id_List prepend_id_list( c_constr xid, a_Id_List list, uint32_t line, uint32_t where ); |
| 253 |
a_Func_Def new_func_def( ae_Keyword func_decl, ae_Keyword static_decl, |
| 254 |
a_Type_Decl type_decl, c_str name, |
| 255 |
a_Arg_List arg_list, a_Stmt code, uint32_t is_from_ast, |
| 256 |
uint32_t line, uint32_t where ); |
| 257 |
a_Func_Def new_op_overload( ae_Keyword func_decl, ae_Keyword static_decl, |
| 258 |
a_Type_Decl type_decl, ae_Operator oper, |
| 259 |
a_Arg_List arg_list, a_Stmt code, uint32_t is_from_ast, |
| 260 |
uint32_t overload_post, uint32_t line, uint32_t where, |
| 261 |
uint32_t operPos ); |
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
void delete_program( a_Program program ); |
| 269 |
void delete_section( a_Section section ); |
| 270 |
|
| 271 |
|
| 272 |
void delete_stmt_list( a_Stmt_List list ); |
| 273 |
|
| 274 |
void delete_class_def( a_Class_Def def ); |
| 275 |
void delete_class_body( a_Class_Body body ); |
| 276 |
void delete_class_ext( a_Class_Ext ext ); |
| 277 |
void delete_iface_def( a_Class_Def def ); |
| 278 |
|
| 279 |
void delete_func_def( a_Func_Def def ); |
| 280 |
|
| 281 |
void delete_id_list( a_Id_List list ); |
| 282 |
|
| 283 |
|
| 284 |
void delete_stmt( a_Stmt stmt ); |
| 285 |
void delete_stmt_from_code( a_Stmt stmt ); |
| 286 |
void delete_stmt_from_while( a_Stmt stmt ); |
| 287 |
void delete_stmt_from_until( a_Stmt stmt ); |
| 288 |
void delete_stmt_from_for( a_Stmt stmt ); |
| 289 |
void delete_stmt_from_foreach( a_Stmt stmt ); |
| 290 |
void delete_stmt_from_loop( a_Stmt stmt ); |
| 291 |
void delete_stmt_from_if( a_Stmt stmt ); |
| 292 |
void delete_stmt_from_switch( a_Stmt stmt ); |
| 293 |
void delete_stmt_from_break( a_Stmt stmt ); |
| 294 |
void delete_stmt_from_continue( a_Stmt stmt ); |
| 295 |
void delete_stmt_from_return( a_Stmt stmt ); |
| 296 |
void delete_stmt_from_label( a_Stmt stmt ); |
| 297 |
void delete_stmt_from_import( a_Stmt stmt ); |
| 298 |
void delete_stmt_from_doc( a_Stmt stmt ); |
| 299 |
void delete_stmt_from_example( a_Stmt stmt ); |
| 300 |
|
| 301 |
|
| 302 |
void delete_exp( a_Exp exp ); |
| 303 |
void delete_exp_from_binary( a_Exp e ); |
| 304 |
void delete_exp_from_unary( a_Exp e ); |
| 305 |
void delete_exp_from_cast( a_Exp e ); |
| 306 |
void delete_exp_from_array( a_Exp e ); |
| 307 |
void delete_exp_from_func_call( a_Exp e ); |
| 308 |
void delete_exp_from_member_dot( a_Exp e ); |
| 309 |
void delete_exp_from_postfix( a_Exp e ); |
| 310 |
void delete_exp_from_dur( a_Exp e ); |
| 311 |
void delete_exp_from_if( a_Exp e ); |
| 312 |
void delete_exp_from_id( a_Exp_Primary e ); |
| 313 |
void delete_exp_from_str( a_Exp_Primary e ); |
| 314 |
void delete_exp_from_char( a_Exp_Primary e ); |
| 315 |
void delete_exp_from_array_lit( a_Exp_Primary et ); |
| 316 |
void delete_exp_from_complex( a_Exp_Primary e ); |
| 317 |
void delete_exp_from_polar( a_Exp_Primary e ); |
| 318 |
void delete_exp_from_vec( a_Exp_Primary e ); |
| 319 |
void delete_exp_from_hack( a_Exp_Primary e ); |
| 320 |
void delete_exp_decl( a_Exp e ); |
| 321 |
void delete_var_decl_list( a_Var_Decl_List list ); |
| 322 |
void delete_var_decl( a_Var_Decl decl ); |
| 323 |
void delete_type_decl( a_Type_Decl decl ); |
| 324 |
void delete_arg_list( a_Arg_List list ); |
| 325 |
void delete_array_sub( a_Array_Sub sub ); |
| 326 |
void delete_complex( a_Complex c ); |
| 327 |
void delete_polar( a_Polar p ); |
| 328 |
void delete_vec( a_Vec v ); |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
struct a_Ctor_Call_ { int invoked; a_Exp args; t_CKFUNC func; int primitive; }; |
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
struct a_Exp_Binary_ { a_Exp lhs; ae_Operator op; a_Exp rhs; t_CKFUNC ck_func; t_CKFUNC ck_overload_func; uint32_t line; uint32_t where; a_Exp self; }; |
| 343 |
struct a_Exp_Cast_ { a_Type_Decl type; a_Exp exp; uint32_t line; uint32_t where; a_Exp self; }; |
| 344 |
struct a_Exp_Unary_ { ae_Operator op; a_Exp exp; a_Type_Decl type; struct a_Ctor_Call_ ctor; a_Array_Sub array; |
| 345 |
a_Stmt code; t_CKFUNC ck_overload_func; uint32_t line; uint32_t where; a_Exp self; }; |
| 346 |
struct a_Exp_Postfix_ { a_Exp exp; ae_Operator op; t_CKFUNC ck_overload_func; uint32_t line; uint32_t where; a_Exp self; }; |
| 347 |
struct a_Exp_Dur_ { a_Exp base; a_Exp unit; uint32_t line; uint32_t where; a_Exp self; }; |
| 348 |
struct a_Exp_Array_ { a_Exp base; a_Array_Sub indices; uint32_t line; uint32_t where; a_Exp self; }; |
| 349 |
struct a_Exp_Func_Call_ { a_Exp func; a_Exp args; t_CKTYPE ret_type; |
| 350 |
t_CKFUNC ck_func; t_CKVMCODE ck_vm_code; uint32_t line; uint32_t where; a_Exp self; }; |
| 351 |
struct a_Exp_Dot_Member_ { a_Exp base; t_CKTYPE t_base; S_Symbol xid; t_CKBOOL isSpecialPrimitiveFunc; uint32_t line; uint32_t where; a_Exp self; }; |
| 352 |
struct a_Exp_If_ { a_Exp cond; a_Exp if_exp; a_Exp else_exp; uint32_t line; uint32_t where; a_Exp self; }; |
| 353 |
struct a_Exp_Decl_ { a_Type_Decl type; a_Var_Decl_List var_decl_list; int num_var_decls; int is_static; int is_global; |
| 354 |
int is_const; t_CKTYPE ck_type; int is_auto; uint32_t line; uint32_t where; a_Exp self; }; |
| 355 |
struct a_Exp_Hack_ { a_Exp exp; uint32_t line; uint32_t where; a_Exp self; }; |
| 356 |
struct a_Var_Decl_List_ { a_Var_Decl var_decl; a_Var_Decl_List next; uint32_t line; uint32_t where; a_Exp self; }; |
| 357 |
|
| 358 |
struct a_Var_Decl_ { S_Symbol xid; struct a_Ctor_Call_ ctor; |
| 359 |
a_Array_Sub array; t_CKVALUE value; void * addr; t_CKTYPE ck_type; |
| 360 |
int ref; int force_ref; |
| 361 |
uint32_t line; uint32_t where; a_Exp self; }; |
| 362 |
struct a_Type_Decl_ { a_Id_List xid; a_Array_Sub array; int ref; uint32_t line; uint32_t where; }; |
| 363 |
struct a_Array_Sub_ { t_CKUINT depth; a_Exp exp_list; uint32_t line; uint32_t where; a_Exp self; |
| 364 |
int err_num; int err_pos; }; |
| 365 |
struct a_Arg_List_ { a_Type_Decl type_decl; a_Var_Decl var_decl; t_CKTYPE type; |
| 366 |
a_Arg_List next; uint32_t line; uint32_t where; a_Exp self; }; |
| 367 |
struct a_Complex_ { a_Exp re; a_Exp im; uint32_t line; uint32_t where; a_Exp self; }; |
| 368 |
struct a_Polar_ { a_Exp mod; a_Exp phase; uint32_t line; uint32_t where; a_Exp self; }; |
| 369 |
struct a_Vec_ { a_Exp args; int numdims; uint32_t line; uint32_t where; a_Exp self; }; |
| 370 |
struct a_Import_ { c_str what; a_Import next; uint32_t line; uint32_t where; }; |
| 371 |
struct a_Doc_ { c_str desc; a_Doc next; uint32_t line; uint32_t where; }; |
| 372 |
struct a_Example_ { c_str desc; a_Example next; uint32_t line; uint32_t where; }; |
| 373 |
|
| 374 |
|
| 375 |
typedef enum { ae_primary_var, ae_primary_num, ae_primary_float, |
| 376 |
ae_primary_str, ae_primary_array, ae_primary_exp, |
| 377 |
ae_primary_hack, ae_primary_complex, ae_primary_polar, |
| 378 |
ae_primary_vec, ae_primary_char, ae_primary_nil |
| 379 |
} ae_Exp_Primary_Type; |
| 380 |
|
| 381 |
struct a_Exp_Primary_ |
| 382 |
{ |
| 383 |
ae_Exp_Primary_Type s_type; |
| 384 |
t_CKVALUE value; |
| 385 |
|
| 386 |
t_CKFUNC func_alias; |
| 387 |
|
| 388 |
union |
| 389 |
{ |
| 390 |
S_Symbol var; |
| 391 |
t_CKINT num; |
| 392 |
t_CKFLOAT fnum; |
| 393 |
c_str str; |
| 394 |
c_str chr; |
| 395 |
a_Array_Sub array; |
| 396 |
a_Exp exp; |
| 397 |
a_Complex complex; |
| 398 |
a_Polar polar; |
| 399 |
a_Vec vec; |
| 400 |
}; |
| 401 |
|
| 402 |
uint32_t line; uint32_t where; |
| 403 |
a_Exp self; |
| 404 |
}; |
| 405 |
|
| 406 |
|
| 407 |
typedef enum { ae_exp_binary = 0, ae_exp_unary, ae_exp_cast, ae_exp_postfix, |
| 408 |
ae_exp_dur, ae_exp_primary, ae_exp_array, ae_exp_func_call, |
| 409 |
ae_exp_dot_member, ae_exp_if, ae_exp_decl |
| 410 |
} ae_Exp_Type; |
| 411 |
|
| 412 |
typedef enum { ae_meta_value = 0, ae_meta_var } ae_Exp_Meta; |
| 413 |
|
| 414 |
struct a_Exp_ |
| 415 |
{ |
| 416 |
ae_Exp_Type s_type; |
| 417 |
ae_Exp_Meta s_meta; |
| 418 |
t_CKTYPE type; |
| 419 |
t_CKNSPC owner; |
| 420 |
a_Exp next; |
| 421 |
|
| 422 |
t_CKUINT group_size; |
| 423 |
t_CKTYPE cast_to; |
| 424 |
t_CKUINT emit_var; |
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
t_CKBOOL emit_as_funccall; |
| 430 |
|
| 431 |
union |
| 432 |
{ |
| 433 |
struct a_Exp_Binary_ binary; |
| 434 |
struct a_Exp_Unary_ unary; |
| 435 |
struct a_Exp_Cast_ cast; |
| 436 |
struct a_Exp_Postfix_ postfix; |
| 437 |
struct a_Exp_Dur_ dur; |
| 438 |
struct a_Exp_Primary_ primary; |
| 439 |
struct a_Exp_Array_ array; |
| 440 |
struct a_Exp_Func_Call_ func_call; |
| 441 |
struct a_Exp_Dot_Member_ dot_member; |
| 442 |
struct a_Exp_If_ exp_if; |
| 443 |
struct a_Exp_Decl_ decl; |
| 444 |
}; |
| 445 |
|
| 446 |
uint32_t line; uint32_t where; |
| 447 |
}; |
| 448 |
|
| 449 |
struct a_Stmt_While_ { int is_do; a_Exp cond; a_Stmt body; uint32_t line; uint32_t where; a_Stmt self; }; |
| 450 |
struct a_Stmt_Until_ { int is_do; a_Exp cond; a_Stmt body; uint32_t line; uint32_t where; a_Stmt self; }; |
| 451 |
struct a_Stmt_For_ { a_Stmt c1; a_Stmt c2; a_Exp c3; a_Stmt body; uint32_t line; uint32_t where; a_Stmt self; }; |
| 452 |
struct a_Stmt_ForEach_ { a_Exp theIter; a_Exp theArray; a_Stmt body; uint32_t line; uint32_t where; a_Stmt self; }; |
| 453 |
struct a_Stmt_Loop_ { a_Exp cond; a_Stmt body; uint32_t line; uint32_t where; a_Stmt self; }; |
| 454 |
struct a_Stmt_If_ { a_Exp cond; a_Stmt if_body; a_Stmt else_body; uint32_t line; uint32_t where; a_Stmt self; }; |
| 455 |
struct a_Stmt_Switch_ { a_Exp val; uint32_t line; uint32_t where; a_Stmt self; }; |
| 456 |
struct a_Stmt_Break_ { uint32_t line; uint32_t where; a_Stmt self; }; |
| 457 |
struct a_Stmt_Continue_ { uint32_t line; uint32_t where; a_Stmt self; }; |
| 458 |
struct a_Stmt_Return_ { a_Exp val; uint32_t line; uint32_t where; a_Stmt self; }; |
| 459 |
struct a_Stmt_Case_ { a_Exp exp; uint32_t line; uint32_t where; a_Stmt self; }; |
| 460 |
struct a_Stmt_GotoLabel_ { S_Symbol name; uint32_t line; uint32_t where; a_Stmt self; }; |
| 461 |
struct a_Stmt_Import_ { a_Import list; uint32_t line; uint32_t where; a_Stmt self; }; |
| 462 |
struct a_Stmt_Doc_ { a_Doc list; uint32_t line; uint32_t where; a_Stmt self; }; |
| 463 |
struct a_Stmt_Example_ { a_Example list; uint32_t line; uint32_t where; a_Stmt self; }; |
| 464 |
struct a_Stmt_Code_ |
| 465 |
{ |
| 466 |
|
| 467 |
a_Stmt_List stmt_list; |
| 468 |
|
| 469 |
t_CKBOOL allControlPathsReturn; |
| 470 |
|
| 471 |
uint32_t line; uint32_t where; a_Stmt self; |
| 472 |
}; |
| 473 |
|
| 474 |
|
| 475 |
typedef enum { ae_stmt_exp, ae_stmt_while, ae_stmt_until, ae_stmt_for, ae_stmt_foreach, |
| 476 |
ae_stmt_loop, ae_stmt_if, ae_stmt_code, ae_stmt_switch, ae_stmt_break, |
| 477 |
ae_stmt_continue, ae_stmt_return, ae_stmt_case, ae_stmt_gotolabel, |
| 478 |
ae_stmt_import, ae_stmt_doc, ae_stmt_example |
| 479 |
} ae_Stmt_Type; |
| 480 |
|
| 481 |
|
| 482 |
struct a_Stmt_ |
| 483 |
{ |
| 484 |
|
| 485 |
ae_Stmt_Type s_type; |
| 486 |
|
| 487 |
t_CKBOOL allControlPathsReturn; |
| 488 |
|
| 489 |
t_CKUINT numObjsToRelease; |
| 490 |
|
| 491 |
|
| 492 |
t_CKBOOL hasStaticDecl; |
| 493 |
|
| 494 |
|
| 495 |
union |
| 496 |
{ |
| 497 |
a_Exp stmt_exp; |
| 498 |
struct a_Stmt_Code_ stmt_code; |
| 499 |
struct a_Stmt_While_ stmt_while; |
| 500 |
struct a_Stmt_Until_ stmt_until; |
| 501 |
struct a_Stmt_Loop_ stmt_loop; |
| 502 |
struct a_Stmt_For_ stmt_for; |
| 503 |
struct a_Stmt_ForEach_ stmt_foreach; |
| 504 |
struct a_Stmt_If_ stmt_if; |
| 505 |
struct a_Stmt_Switch_ stmt_switch; |
| 506 |
struct a_Stmt_Break_ stmt_break; |
| 507 |
struct a_Stmt_Continue_ stmt_continue; |
| 508 |
struct a_Stmt_Return_ stmt_return; |
| 509 |
struct a_Stmt_Case_ stmt_case; |
| 510 |
struct a_Stmt_GotoLabel_ stmt_gotolabel; |
| 511 |
struct a_Stmt_Import_ stmt_import; |
| 512 |
struct a_Stmt_Doc_ stmt_doc; |
| 513 |
struct a_Stmt_Example_ stmt_example; |
| 514 |
}; |
| 515 |
|
| 516 |
|
| 517 |
uint32_t line; uint32_t where; |
| 518 |
}; |
| 519 |
|
| 520 |
|
| 521 |
struct a_Stmt_List_ |
| 522 |
{ |
| 523 |
|
| 524 |
a_Stmt stmt; |
| 525 |
|
| 526 |
a_Stmt_List next; |
| 527 |
|
| 528 |
uint32_t line; uint32_t where; |
| 529 |
}; |
| 530 |
|
| 531 |
|
| 532 |
struct a_Class_Def_ { ae_Keyword decl; a_Id_List name; a_Class_Ext ext; |
| 533 |
a_Class_Body body; t_CKTYPE type; int iface; t_CKNSPC home; |
| 534 |
uint32_t line; uint32_t where; }; |
| 535 |
struct a_Class_Ext_ { a_Id_List extend_id; a_Id_List impl_list; uint32_t line; uint32_t where; }; |
| 536 |
struct a_Class_Body_ { a_Section section; a_Class_Body next; uint32_t line; uint32_t where; }; |
| 537 |
struct a_Id_List_ { S_Symbol xid; a_Id_List next; uint32_t line; uint32_t where; }; |
| 538 |
|
| 539 |
typedef enum { ae_func_user, ae_func_builtin } ae_Func_Type; |
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
struct a_Func_Def_ { |
| 544 |
ae_Keyword func_decl; |
| 545 |
ae_Keyword static_decl; |
| 546 |
a_Type_Decl type_decl; |
| 547 |
t_CKTYPE ret_type; |
| 548 |
S_Symbol name; |
| 549 |
ae_Operator op2overload; |
| 550 |
a_Arg_List arg_list; |
| 551 |
a_Stmt code; |
| 552 |
t_CKFUNC ck_func; |
| 553 |
unsigned int global; |
| 554 |
unsigned int s_type; |
| 555 |
unsigned int stack_depth; |
| 556 |
void * dl_func_ptr; |
| 557 |
ae_FuncPointerKind dl_fp_kind; |
| 558 |
uint32_t ast_owned; |
| 559 |
uint32_t overload_post; |
| 560 |
uint32_t vm_refs; |
| 561 |
uint32_t line; uint32_t where; uint32_t operWhere; |
| 562 |
}; |
| 563 |
|
| 564 |
|
| 565 |
typedef enum { ae_section_stmt, ae_section_class, ae_section_func } ae_Section_Type; |
| 566 |
|
| 567 |
struct a_Section_ |
| 568 |
{ |
| 569 |
ae_Section_Type s_type; |
| 570 |
|
| 571 |
union |
| 572 |
{ |
| 573 |
a_Stmt_List stmt_list; |
| 574 |
a_Class_Def class_def; |
| 575 |
a_Func_Def func_def; |
| 576 |
}; |
| 577 |
|
| 578 |
uint32_t line; uint32_t where; |
| 579 |
}; |
| 580 |
|
| 581 |
struct a_Program_ { a_Section section; a_Program next; uint32_t line; uint32_t where; }; |
| 582 |
|
| 583 |
|
| 584 |
#if defined(_cplusplus) || defined(__cplusplus) |
| 585 |
} |
| 586 |
#endif |
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
#endif |