Parsing exprs, enum_decls, Introduce intern table, symbol table

This commit is contained in:
Krzosa Karol
2022-04-29 11:22:10 +02:00
parent d462892e14
commit 9cbbb4d616
20 changed files with 1831 additions and 335 deletions

63
decl.h Normal file
View File

@@ -0,0 +1,63 @@
#pragma once
typedef struct Note Note;
typedef struct Decl Decl;
typedef struct Decl_Enum_Child Decl_Enum_Child;
typedef enum Decl_Kind{
DK_None,
DK_Variable,
DK_Typedef,
DK_Struct,
DK_Union,
DK_Enum,
DK_Function,
}Decl_Kind;
struct Note{
Intern_String string;
Token *token;
Expr *expr;
Note *next;
Note *first;
Note *last;
};
struct Decl_Enum_Child{
Decl_Enum_Child *next;
Token *token; // name
Expr *expr;
};
struct Decl{
Decl_Kind kind;
Decl *next;
Intern_String name;
Token *token;
Note *first_note;
Note *last_note;
union{
struct{
Decl_Enum_Child *first;
Decl_Enum_Child *last;
} enum_val;
struct{
Decl *first;
Decl *last;
} aggregate_val;
struct{
Decl *first;
Decl *last;
Type *return_type;
}func_val;
struct{
Type *type;
Expr *expr;
}var_val;
struct{
Type *type;
}typedef_val;
};
};