52 lines
772 B
C
52 lines
772 B
C
typedef struct AST_Node AST_Node;
|
|
typedef struct Expr Expr;
|
|
|
|
typedef enum AST_Kind{
|
|
AK_None,
|
|
AK_Undefined,
|
|
|
|
AK_BaseType,
|
|
AK_Typedef,
|
|
AK_Enum,
|
|
AK_Struct,
|
|
AK_Union,
|
|
|
|
AK_Note,
|
|
AK_List,
|
|
|
|
AK_Pointer,
|
|
AK_Array,
|
|
AK_Function,
|
|
AK_Variable,
|
|
AK_EnumChild,
|
|
|
|
}AST_Kind;
|
|
|
|
struct AST_Node{
|
|
AST_Kind kind;
|
|
Token *pos;
|
|
Expr *expr;
|
|
Intern_String name;
|
|
|
|
AST_Node *next;
|
|
AST_Node *scope_next;
|
|
|
|
AST_Node *first_note;
|
|
AST_Node *last_note;
|
|
|
|
AST_Node *first_child;
|
|
AST_Node *last_child;
|
|
union{
|
|
AST_Node *pointer;
|
|
SizeU base_type_size;
|
|
AST_Node *typedef_type;
|
|
AST_Node *func_return_type;
|
|
};
|
|
};
|
|
|
|
function B32
|
|
ast_is_type(AST_Node *n){
|
|
B32 result = n->kind >= AK_BaseType && n->kind <= AK_Union;
|
|
return result;
|
|
}
|