Zen-C
Loading...
Searching...
No Matches
ast.h
Go to the documentation of this file.
1
2#ifndef AST_H
3#define AST_H
4
5#include "zprep.h"
6#include <stdlib.h>
7
8// Forward declarations.
9struct ASTNode;
10typedef struct ASTNode ASTNode;
11
12// ** Formal Type System **
13// Used for Generics, Type Inference, and robust pointer handling.
14
25
76
80typedef struct Type
81{
83 char *name;
84 struct Type *inner;
85 struct Type **args;
89 int is_raw; // Raw function pointer (fn*)
91 union
92 {
95 struct
96 {
100 struct
101 {
105 };
107
108// ** AST Node Types **
176
177// ** AST Node Structure **
178typedef struct Attribute
179{
180 char *name;
181 char **args;
185
187{
190 int line; // Source line number for debugging.
191
192 // Type information.
193 char *resolved_type; // Legacy string representation (for example: "int",
194 // "User*"). > Yes, 'legacy' is a thing, this is the
195 // third iteration > of this project (for now).
196 Type *type_info; // Formal type object (for inference/generics).
198 Token definition_token; // For LSP: Location where the symbol used in this
199 // node was defined.
200
201 union
202 {
203 struct
204 {
207
208 struct
209 {
210 char *name;
211 char *generic_params; // <T, U>
212 char *args; // Legacy string args.
213 char *ret_type; // Legacy string return type.
216 char **defaults;
217 char **param_names; // Explicit parameter names.
222 int must_use; // @must_use: warn if return value is discarded.
223 // GCC attributes
224 int noinline; // @noinline
225 int constructor; // @constructor
226 int destructor; // @destructor
227 int unused; // @unused
228 int weak; // @weak
229 int is_export; // @export (visibility default).
230 int cold; // @cold
231 int hot; // @hot
232 int noreturn; // @noreturn
233 int pure; // @pure
234 char *section; // @section("name")
235 int is_async; // async function
236 int is_comptime; // @comptime function
237 // CUDA qualifiers
238 int cuda_global; // @global -> __global__
239 int cuda_device; // @device -> __device__
240 int cuda_host; // @host -> __host__
241
242 char **c_type_overrides; // @ctype("...") per parameter
243
244 Attribute *attributes; // Custom attributes
246
247 struct
248 {
251
252 struct
253 {
256
257 struct
258 {
259 char *name;
260 char *type_str;
266
267 struct
268 {
269 char *name;
273
274 struct
275 {
276 char *name;
281
282 struct
283 {
284 char *alias;
289
290 struct
291 {
296
297 struct
298 {
300 ASTNode *body;
303
304 struct
305 {
309 ASTNode *body;
310 char *loop_label;
312
313 struct
314 {
315 char *var_name;
318 char *step;
320 ASTNode *body;
322
323 struct
324 {
325 ASTNode *body;
326 char *loop_label;
328
329 struct
330 {
331 char *count;
332 ASTNode *body;
334
335 struct
336 {
338 ASTNode *body;
340
341 struct
342 {
344 ASTNode *body;
346
347 struct
348 {
350 ASTNode *body;
351 char *loop_label;
353
354 struct
355 {
359
360 struct
361 {
362 char *pattern;
363 char **binding_names; // Multiple bindings
364 int binding_count; // Count
365 int *binding_refs; // Ref flags per binding
368 ASTNode *body;
371
372 struct
373 {
374 char *op;
378
379 struct
380 {
381 char *op;
384
385 struct
386 {
388 unsigned long long int_val;
389 double float_val;
392
393 struct
394 {
395 char *name;
398
399 struct
400 {
403 char **arg_names;
404 int arg_count;
406
407 struct
408 {
410 char *field;
413
414 struct
415 {
419
420 struct
421 {
422 ASTNode *array;
423 ASTNode *start;
424 ASTNode *end;
426
427 struct
428 {
430 ASTNode *expr;
432
433 struct
434 {
438
439 struct
440 {
442 int count;
444
445 struct
446 {
447 char *name;
449 int is_template;
450 char **generic_params; // Array of generic parameter names (for example, ["K", "V"])
451 int generic_param_count; // Number of generic parameters
452 char *parent;
454 int is_packed; // @packed attribute.
455 int align; // @align(N) attribute, 0 = default.
456 int is_incomplete; // Forward declaration (prototype)
457 int is_export; // @export attribute
458 Attribute *attributes; // Custom attributes
459 char **used_structs; // Names of structs used/mixed-in
461 int is_opaque;
462 char *defined_in_file; // File where the struct is defined (for privacy check)
464
465 struct
466 {
467 char *name;
468 char *type;
471
472 struct
473 {
474 char *name;
476 char **generic_params;
479
480 struct
481 {
482 char *struct_name;
485
486 struct
487 {
489 char *target_type;
492
493 struct
494 {
495 char *path;
498
499 struct
500 {
501 char *content;
505
506 struct
507 {
508 char *name;
509 ASTNode *body;
511
512 struct
513 {
515 char *message;
517
518 struct
519 {
522
523 struct
524 {
526 char *body;
528
529 struct
530 {
531 char **names;
532 int count;
535 char *struct_name; // "Point" (or NULL if unchecked/inferred).
536 char **field_names; // NULL if same as 'names', otherwise mapped.
538 char *guard_variant; // "Some", "Ok".
541
542 struct
543 {
548
549 struct
550 {
551 char *code;
553 char **outputs;
555 char **inputs;
556 char **clobbers;
561
562 struct
563 {
564 char **param_names;
567 ASTNode *body;
575
576 struct
577 {
578 char *target_type;
579 ASTNode *expr;
581
582 struct
583 {
587
588 struct
589 {
590 char *label_name;
592
593 struct
594 {
597
598 struct
599 {
600 char *target_label;
602
603 struct
604 {
605 ASTNode *expr;
607
608 struct
609 {
610 int kind; // 0=type_name, 1=fields.
613
614 struct
615 {
616 ASTNode *expr;
618
619 struct
620 {
621 ASTNode *call; // The kernel call (NODE_EXPR_CALL)
622 ASTNode *grid; // Grid dimensions expression
623 ASTNode *block; // Block dimensions expression
624 ASTNode *shared_mem; // Optional shared memory size (NULL = default)
625 ASTNode *stream; // Optional CUDA stream (NULL = default)
627
628 struct
629 {
633
634 struct
635 {
636 ASTNode *ap;
638
639 struct
640 {
644
645 struct
646 {
647 ASTNode *ap;
650 };
651};
652
653// ** Functions **
655void ast_free(ASTNode *node);
656
657Type *type_new(TypeKind kind);
658Type *type_new_ptr(Type *inner);
659int type_eq(Type *a, Type *b);
660int is_integer_type(Type *t);
661char *type_to_string(Type *t);
662char *type_to_c_string(Type *t);
663
664#endif
char * type_to_c_string(Type *t)
Definition ast.c:403
Type * type_new(TypeKind kind)
Definition ast.c:52
ASTNode * ast_create(NodeType type)
Definition ast.c:38
LiteralKind
Kind of literal value.
Definition ast.h:19
@ LITERAL_INT
Integer literal.
Definition ast.h:20
@ LITERAL_STRING
String literal.
Definition ast.h:22
@ LITERAL_CHAR
Character literal.
Definition ast.h:23
@ LITERAL_FLOAT
Floating point literal.
Definition ast.h:21
int is_integer_type(Type *t)
Definition ast.c:90
char * type_to_string(Type *t)
Definition ast.c:197
TypeKind
Formal type system kinds.
Definition ast.h:30
@ TYPE_I128
i128 type.
Definition ast.h:44
@ TYPE_C_LONG
c_long (long).
Definition ast.h:58
@ TYPE_BITINT
C23 _BitInt(N).
Definition ast.h:72
@ TYPE_ENUM
Enum type.
Definition ast.h:66
@ TYPE_FLOAT
float (alias).
Definition ast.h:49
@ TYPE_CHAR
char type.
Definition ast.h:33
@ TYPE_U64
u64 type.
Definition ast.h:43
@ TYPE_BOOL
bool type.
Definition ast.h:32
@ TYPE_C_UINT
c_uint (unsigned int).
Definition ast.h:57
@ TYPE_GENERIC
Generic type parameter (T).
Definition ast.h:70
@ TYPE_INT
int (alias, usually i32).
Definition ast.h:48
@ TYPE_U8
u8 type.
Definition ast.h:37
@ TYPE_I16
i16 type.
Definition ast.h:38
@ TYPE_F64
f64 type.
Definition ast.h:47
@ TYPE_ALIAS
Opaque type alias.
Definition ast.h:71
@ TYPE_C_SHORT
c_short (short).
Definition ast.h:60
@ TYPE_UNKNOWN
Unknown/unresolved type.
Definition ast.h:74
@ TYPE_I64
i64 type.
Definition ast.h:42
@ TYPE_BYTE
byte.
Definition ast.h:52
@ TYPE_F32
f32 type.
Definition ast.h:46
@ TYPE_C_USHORT
c_ushort (unsigned short).
Definition ast.h:61
@ TYPE_C_ULONG
c_ulong (unsigned long).
Definition ast.h:59
@ TYPE_POINTER
Pointer type (*).
Definition ast.h:67
@ TYPE_C_INT
c_int (int).
Definition ast.h:56
@ TYPE_VOID
void type.
Definition ast.h:31
@ TYPE_U16
u16 type.
Definition ast.h:39
@ TYPE_C_CHAR
c_char (char).
Definition ast.h:62
@ TYPE_STRUCT
Struct type.
Definition ast.h:65
@ TYPE_U128
u128 type.
Definition ast.h:45
@ TYPE_U32
u32 type.
Definition ast.h:41
@ TYPE_ISIZE
isize (pointer size signed).
Definition ast.h:51
@ TYPE_C_UCHAR
c_uchar (unsigned char).
Definition ast.h:63
@ TYPE_UINT
uint (alias).
Definition ast.h:54
@ TYPE_USIZE
usize (pointer size unsigned).
Definition ast.h:50
@ TYPE_I32
i32 type.
Definition ast.h:40
@ TYPE_I8
i8 type.
Definition ast.h:36
@ TYPE_U0
u0 type.
Definition ast.h:35
@ TYPE_ARRAY
Fixed size array [N].
Definition ast.h:68
@ TYPE_STRING
string type.
Definition ast.h:34
@ TYPE_UBITINT
C23 unsigned _BitInt(N).
Definition ast.h:73
@ TYPE_FUNCTION
Function pointer or reference.
Definition ast.h:69
@ TYPE_RUNE
rune.
Definition ast.h:53
NodeType
AST Node Types.
Definition ast.h:113
@ NODE_FOR
For loop.
Definition ast.h:123
@ NODE_EXPR_BINARY
Binary expression (a + b).
Definition ast.h:133
@ NODE_GUARD
Guard clause (if !cond return).
Definition ast.h:128
@ NODE_FIELD
Struct field.
Definition ast.h:146
@ NODE_EXPR_STRUCT_INIT
Struct initializer.
Definition ast.h:142
@ NODE_EXPR_SLICE
Slice operation.
Definition ast.h:144
@ NODE_REFLECTION
Reflection info.
Definition ast.h:167
@ NODE_MATCH
Match statement.
Definition ast.h:131
@ NODE_TEST
Test block.
Definition ast.h:154
@ NODE_ENUM_VARIANT
Enum variant.
Definition ast.h:148
@ NODE_IMPL
Impl block.
Definition ast.h:150
@ NODE_ENUM
Enum definition.
Definition ast.h:147
@ NODE_STRUCT
Struct definition.
Definition ast.h:145
@ NODE_PLUGIN
Plugin invocation.
Definition ast.h:161
@ NODE_VA_END
va_end intrinsic.
Definition ast.h:172
@ NODE_TYPE_ALIAS
Type alias (typedef).
Definition ast.h:120
@ NODE_EXPR_INDEX
Array index (a[b]).
Definition ast.h:139
@ NODE_REPEAT
Repeat loop (n times).
Definition ast.h:126
@ NODE_INCLUDE
Include directive.
Definition ast.h:152
@ NODE_ASM
Assembly block.
Definition ast.h:159
@ NODE_EXPR_CALL
Function call.
Definition ast.h:137
@ NODE_CONTINUE
Continue statement.
Definition ast.h:130
@ NODE_VA_COPY
va_copy intrinsic.
Definition ast.h:173
@ NODE_VA_START
va_start intrinsic.
Definition ast.h:171
@ NODE_EXPR_SIZEOF
Sizeof expression.
Definition ast.h:141
@ NODE_CUDA_LAUNCH
CUDA kernel launch (<<<...>>>).
Definition ast.h:170
@ NODE_VA_ARG
va_arg intrinsic.
Definition ast.h:174
@ NODE_EXPR_LITERAL
Literal value.
Definition ast.h:135
@ NODE_DESTRUCT_VAR
Destructuring declaration.
Definition ast.h:157
@ NODE_GOTO
Goto statement.
Definition ast.h:162
@ NODE_LAMBDA
Lambda function.
Definition ast.h:160
@ NODE_VAR_DECL
Variable declaration.
Definition ast.h:118
@ NODE_TERNARY
Ternary expression (?:).
Definition ast.h:158
@ NODE_BLOCK
Code block { ... }.
Definition ast.h:116
@ NODE_FUNCTION
Function definition.
Definition ast.h:115
@ NODE_EXPR_VAR
Variable reference.
Definition ast.h:136
@ NODE_EXPR_UNARY
Unary expression (!a).
Definition ast.h:134
@ NODE_RAW_STMT
Raw statement (transpiler bypass).
Definition ast.h:153
@ NODE_AWAIT
Await expression.
Definition ast.h:168
@ NODE_EXPR_ARRAY_LITERAL
Array literal.
Definition ast.h:143
@ NODE_LOOP
Infinite loop.
Definition ast.h:125
@ NODE_TRAIT
Trait definition.
Definition ast.h:149
@ NODE_DO_WHILE
Do-while loop.
Definition ast.h:164
@ NODE_RETURN
Return statement.
Definition ast.h:117
@ NODE_TYPEOF
Typeof operator.
Definition ast.h:165
@ NODE_IMPL_TRAIT
Trait implementation.
Definition ast.h:151
@ NODE_EXPR_CAST
Type cast.
Definition ast.h:140
@ NODE_TRY
Try statement (error handling).
Definition ast.h:166
@ NODE_ASSERT
Assert statement.
Definition ast.h:155
@ NODE_REPL_PRINT
Implicit print (REPL).
Definition ast.h:169
@ NODE_DEFER
Defer statement.
Definition ast.h:156
@ NODE_IF
If statement.
Definition ast.h:121
@ NODE_MATCH_CASE
Case within match.
Definition ast.h:132
@ NODE_BREAK
Break statement.
Definition ast.h:129
@ NODE_UNLESS
Unless statement (if !cond).
Definition ast.h:127
@ NODE_ROOT
Root of the AST.
Definition ast.h:114
@ NODE_LABEL
Label.
Definition ast.h:163
@ NODE_CONST
Constant definition.
Definition ast.h:119
@ NODE_FOR_RANGE
For-range loop (iterator).
Definition ast.h:124
@ NODE_WHILE
While loop.
Definition ast.h:122
@ NODE_EXPR_MEMBER
Member access (a.b).
Definition ast.h:138
Type * type_new_ptr(Type *inner)
Definition ast.c:68
int type_eq(Type *a, Type *b)
Definition ast.c:126
void ast_free(ASTNode *node)
Definition ast.c:46
Definition ast.h:187
char * type_str
Definition ast.h:260
char ** arg_names
Definition ast.h:403
ASTNode * shared_mem
Definition ast.h:624
int is_inclusive
Definition ast.h:319
char * string_val
Definition ast.h:390
ASTNode * step
Definition ast.h:308
int noinline
Definition ast.h:224
int is_expression
Definition ast.h:570
ASTNode * body
Definition ast.h:214
char ** captured_types
Definition ast.h:572
double float_val
Definition ast.h:389
char * alias
Definition ast.h:284
struct ASTNode::@4::@23 match_stmt
struct ASTNode::@4::@52 goto_stmt
struct ASTNode::@4::@54 break_stmt
ASTNode * children
Definition ast.h:205
char ** outputs
Definition ast.h:553
struct ASTNode::@4::@40 impl_trait
int count
Definition ast.h:442
int is_guard
Definition ast.h:537
int num_clobbers
Definition ast.h:559
int binding_count
Definition ast.h:364
char * guard_variant
Definition ast.h:538
ASTNode * false_expr
Definition ast.h:546
ASTNode * methods
Definition ast.h:475
char * target_type
Definition ast.h:429
struct ASTNode::@4::@19 repeat_stmt
int is_destructuring
Definition ast.h:366
Type * payload
Definition ast.h:270
int is_template
Definition ast.h:278
char * parent
Definition ast.h:452
struct ASTNode::@4::@60 va_start
char ** binding_names
Definition ast.h:363
struct ASTNode::@4::@14 if_stmt
char * generic_param
Definition ast.h:279
struct ASTNode::@4::@9 ret
int num_params
Definition ast.h:568
struct ASTNode::@4::@33 cast
char * generic_params
Definition ast.h:211
struct ASTNode::@4::@17 for_range
int is_struct_destruct
Definition ast.h:534
char ** field_names
Definition ast.h:536
Type * ret_type_info
Definition ast.h:219
struct ASTNode::@4::@27 literal
struct ASTNode::@4::@16 for_stmt
int cuda_host
Definition ast.h:240
int num_inputs
Definition ast.h:558
NodeType type
Definition ast.h:188
struct ASTNode::@4::@63 va_arg
int is_async
Definition ast.h:235
char ** inputs
Definition ast.h:555
int is_opaque
Definition ast.h:286
int cold
Definition ast.h:230
char ** output_modes
Definition ast.h:554
char * plugin_name
Definition ast.h:525
struct ASTNode::@4::@49 asm_stmt
struct ASTNode::@4::@32 slice
struct ASTNode::@4::@12 enm
char ** param_names
Definition ast.h:217
ASTNode * variants
Definition ast.h:277
struct ASTNode::@4::@30 member
ASTNode * dest
Definition ast.h:641
struct ASTNode::@4::@38 trait
ASTNode * index
Definition ast.h:417
int arg_count
Definition ast.h:218
struct ASTNode::@4::@47 destruct
Type * type_info
Definition ast.h:196
ASTNode * stream
Definition ast.h:625
int align
Definition ast.h:455
int is_comptime
Definition ast.h:236
ASTNode * args
Definition ast.h:402
char ** used_structs
Definition ast.h:459
ASTNode * last_arg
Definition ast.h:631
struct ASTNode::@4::@56 try_stmt
char * args
Definition ast.h:212
char * trait_name
Definition ast.h:488
int line
Definition ast.h:190
struct ASTNode::@4::@7 func
int is_system
Definition ast.h:496
char * type
Definition ast.h:468
ASTNode * init_expr
Definition ast.h:261
int used_symbol_count
Definition ast.h:503
char ** captured_vars
Definition ast.h:571
char * label_name
Definition ast.h:584
int is_autofree
Definition ast.h:263
ASTNode * stmt
Definition ast.h:520
char * original_type
Definition ast.h:285
Token definition_token
Definition ast.h:198
ASTNode * value
Definition ast.h:254
int is_pointer_access
Definition ast.h:411
int is_export
Definition ast.h:229
ASTNode * else_body
Definition ast.h:294
Type * target_type
Definition ast.h:611
ASTNode * ap
Definition ast.h:630
ASTNode * src
Definition ast.h:642
ASTNode * end
Definition ast.h:317
ASTNode * fields
Definition ast.h:436
struct ASTNode::@4::@59 cuda_launch
int * binding_refs
Definition ast.h:365
struct ASTNode::@4::@43 test_stmt
ASTNode * true_expr
Definition ast.h:545
struct ASTNode::@4::@53 label_stmt
struct ASTNode::@4::@21 guard_stmt
struct ASTNode::@4::@18 loop_stmt
ASTNode * target
Definition ast.h:409
char * section
Definition ast.h:234
struct ASTNode::@4::@25 binary
int is_union
Definition ast.h:453
unsigned long long int_val
Definition ast.h:388
ASTNode * condition
Definition ast.h:292
struct ASTNode::@4::@6 root
int must_use
Definition ast.h:222
char * ret_type
Definition ast.h:213
int generic_param_count
Definition ast.h:451
int hot
Definition ast.h:231
struct ASTNode::@4::@34 struct_init
int constructor
Definition ast.h:225
ASTNode * grid
Definition ast.h:622
int unused
Definition ast.h:227
ASTNode * next
Definition ast.h:189
struct ASTNode::@4::@20 unless_stmt
struct ASTNode::@4::@42 raw_stmt
int is_packed
Definition ast.h:454
char * body
Definition ast.h:526
char ** param_types
Definition ast.h:565
char * var_name
Definition ast.h:315
struct ASTNode::@4::@10 var_decl
ASTNode * statements
Definition ast.h:249
Token token
Definition ast.h:197
char ** clobbers
Definition ast.h:556
char * step
Definition ast.h:318
int is_default
Definition ast.h:369
char * op
Definition ast.h:374
ASTNode * elements
Definition ast.h:441
int weak
Definition ast.h:228
int is_inline
Definition ast.h:221
int is_volatile
Definition ast.h:552
int is_varargs
Definition ast.h:220
ASTNode * then_body
Definition ast.h:293
ASTNode * right
Definition ast.h:376
struct ASTNode::@4::@45 defer_stmt
struct ASTNode::@4::@29 call
char * return_type
Definition ast.h:566
char * code
Definition ast.h:551
struct ASTNode::@4::@51 size_of
int noreturn
Definition ast.h:232
int is_incomplete
Definition ast.h:456
Attribute * attributes
Definition ast.h:244
ASTNode * callee
Definition ast.h:401
char ** generic_params
Definition ast.h:450
int num_outputs
Definition ast.h:557
struct ASTNode::@4::@48 ternary
struct ASTNode::@4::@35 array_literal
char * name
Definition ast.h:210
int lambda_id
Definition ast.h:569
char ** defaults
Definition ast.h:216
ASTNode * operand
Definition ast.h:382
int cuda_device
Definition ast.h:239
ASTNode * guard
Definition ast.h:367
struct ASTNode::@4::@50 lambda
ASTNode * start
Definition ast.h:316
char * target_label
Definition ast.h:595
ASTNode * init
Definition ast.h:306
ASTNode * goto_expr
Definition ast.h:585
int used_struct_count
Definition ast.h:460
ASTNode * cases
Definition ast.h:357
ASTNode * expr
Definition ast.h:356
struct ASTNode::@4::@8 block
struct ASTNode::@4::@15 while_stmt
struct ASTNode::@4::@11 variant
ASTNode * cond
Definition ast.h:544
char * loop_label
Definition ast.h:301
struct ASTNode::@4::@44 assert_stmt
char * message
Definition ast.h:515
int num_captures
Definition ast.h:573
int pure
Definition ast.h:233
char * content
Definition ast.h:501
struct ASTNode::@4::@28 var_ref
char * path
Definition ast.h:495
char * resolved_type
Definition ast.h:193
char ** names
Definition ast.h:531
struct ASTNode::@4::@58 repl_print
struct ASTNode::@4::@39 impl
struct ASTNode::@4::@57 reflection
char * pattern
Definition ast.h:362
char ** used_symbols
Definition ast.h:502
char * suggestion
Definition ast.h:396
char * field
Definition ast.h:410
char * count
Definition ast.h:331
char ** c_type_overrides
Definition ast.h:242
Type ** arg_types
Definition ast.h:215
LiteralKind type_kind
Definition ast.h:387
int destructor
Definition ast.h:226
int cuda_global
Definition ast.h:238
struct ASTNode::@4::@13 type_alias
struct ASTNode::@4::@55 continue_stmt
char * defined_in_file
Definition ast.h:287
ASTNode * else_block
Definition ast.h:539
ASTNode * left
Definition ast.h:375
struct ASTNode::@4::@62 va_copy
struct ASTNode::@4::@46 plugin_stmt
int kind
Definition ast.h:610
ASTNode * array
Definition ast.h:416
char * struct_name
Definition ast.h:435
struct ASTNode::@4::@24 match_case
int is_static
Definition ast.h:264
ASTNode * block
Definition ast.h:623
struct ASTNode::@4::@36 strct
struct ASTNode::@4::@61 va_end
struct ASTNode::@4::@41 include
ASTNode * call
Definition ast.h:621
struct ASTNode::@4::@26 unary
struct ASTNode::@4::@22 do_while_stmt
int tag_id
Definition ast.h:271
int bit_width
Definition ast.h:469
Definition ast.h:179
struct Attribute * next
Definition ast.h:183
char ** args
Definition ast.h:181
int arg_count
Definition ast.h:182
char * name
Definition ast.h:180
Represents a source token.
Definition zprep.h:119
Represents a formal type in the type system.
Definition ast.h:81
int has_drop
1 if type implements Drop trait (RAII).
Definition ast.h:97
struct Type * inner
Inner type (for POINTER, ARRAY).
Definition ast.h:84
int is_varargs
1 if function type is variadic.
Definition ast.h:93
struct Type ** args
Generic arguments (for GENERIC instantiations).
Definition ast.h:85
int has_iterable
1 if type implements Iterable trait.
Definition ast.h:98
char * name
Name of the type (for STRUCT, GENERIC, ENUM).
Definition ast.h:83
struct Type::@0::@3 alias
int is_opaque_alias
Definition ast.h:102
char * alias_defined_in_file
Definition ast.h:103
struct Type::@0::@2 traits
TypeKind kind
The kind of type.
Definition ast.h:82
int is_restrict
1 if pointer is restrict-qualified.
Definition ast.h:94
int is_raw
Definition ast.h:89
int is_explicit_struct
1 if defined with "struct" keyword explicitly.
Definition ast.h:88
int is_const
1 if const-qualified.
Definition ast.h:87
int array_size
Size for fixed-size arrays. For TYPE_BITINT, this is the bit width.
Definition ast.h:90
int arg_count
Count of generic arguments.
Definition ast.h:86