implemented basic parsing
This commit is contained in:
parent
038930d881
commit
abf1d7c066
10 changed files with 588 additions and 486 deletions
54
sema.h
Normal file
54
sema.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
#ifndef SEMA_H
|
||||
#define SEMA_H
|
||||
|
||||
typedef enum {
|
||||
TYPE_VOID,
|
||||
TYPE_PTR,
|
||||
TYPE_I8,
|
||||
TYPE_I16,
|
||||
TYPE_I32,
|
||||
TYPE_I64,
|
||||
TYPE_U8,
|
||||
TYPE_U16,
|
||||
TYPE_U32,
|
||||
TYPE_U64,
|
||||
TYPE_STRUCT,
|
||||
TYPE_UNION,
|
||||
TYPE_ENUM,
|
||||
} type_tag;
|
||||
|
||||
typedef struct _type {
|
||||
type_tag tag;
|
||||
union {
|
||||
u8 integer;
|
||||
u8 flt; // float
|
||||
struct {
|
||||
bool is_const;
|
||||
bool is_volatile;
|
||||
u16 alignment;
|
||||
struct _type child;
|
||||
} ptr;
|
||||
struct {
|
||||
usize len;
|
||||
struct _type child;
|
||||
} array;
|
||||
struct {
|
||||
struct_layout layout;
|
||||
char *name;
|
||||
usize name_len;
|
||||
usize alignment;
|
||||
member *members;
|
||||
function_decl *decls;
|
||||
} structure;
|
||||
struct {
|
||||
struct_layout layout;
|
||||
char *name;
|
||||
usize name_len;
|
||||
usize alignment;
|
||||
member *members;
|
||||
function_decl *decls;
|
||||
} enum;
|
||||
} data;
|
||||
} type;
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue