C codegen

This commit is contained in:
Krzosa Karol
2022-05-03 20:08:13 +02:00
parent 8c04044ea2
commit 557dde1936
11 changed files with 573 additions and 281 deletions

34
sym.h Normal file
View File

@@ -0,0 +1,34 @@
typedef enum Symbol_Kind{
SYM_None,
SYM_Decl,
SYM_Type,
}Symbol_Kind;
typedef enum Symbol_State{
SYM_STATE_Used,
SYM_STATE_Declared,
}Symbol_State;
typedef struct Symbol{
Symbol_Kind kind;
Symbol_State state;
Symbol *next;
union{
Decl *decl;
struct{
Typespec *spec;
} type;
};
} Symbol;
// First stage would add all symbols as underspecified to the table
// Every encountered typespec would be added to the table as either specified or
// just as encountered name
//
// Then second stage would loop over all of them and report errors on all symbols that were
// found in the wild but not declared
//
//
//
//