C codegen
This commit is contained in:
34
sym.h
Normal file
34
sym.h
Normal 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
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
Reference in New Issue
Block a user