Backup, Decl,Type parsing enum,structs etc.
This commit is contained in:
65
decl.h
65
decl.h
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user