Files
corelang/decl.h

64 lines
949 B
C

#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;
};
};