Backup, Decl,Type parsing enum,structs etc.

This commit is contained in:
Krzosa Karol
2022-04-29 23:28:41 +02:00
parent 9cbbb4d616
commit a5a3acf3ef
12 changed files with 407 additions and 45 deletions

65
decl.h
View File

@@ -61,3 +61,68 @@ struct Decl{
};
};
//-----------------------------------------------------------------------------
// Idea
//-----------------------------------------------------------------------------
typedef struct AST_Node AST_Node;
typedef enum AST_Kind{
AK_None,
AK_Undefined,
AK_BaseType,
AK_Typedef,
AK_Pointer,
AK_Struct,
AK_Union,
AK_Array,
AK_Function,
AK_Variable,
AK_EnumChild,
}AST_Kind;
struct AST_Node{
AST_Kind kind;
Intern_String name;
Expr *expr;
Token *pos;
AST_Node *next;
AST_Node *first_note;
AST_Node *last_note;
union{
AST_Node *pointer;
struct{
SizeU size;
}base_type_val;
struct{
AST_Node *type;
}typedef_val;
struct{
AST_Node *return_type;
AST_Node *first;
AST_Node *last;
}func_val;
struct{
AST_Node *first;
AST_Node *last;
}aggregate;
struct{
AST_Node *first;
AST_Node *last;
}enum_val;
};
};
// Then I can yoink the entire idea of a symbol
// cause AST_Node is THE symbol
typedef struct Scope{
Scope *next;
AST_Node *first;
AST_Node *last;
}Scope;
{
Scope *first;
Scope *last;
}
scope_pop(Parser *p)