35 lines
664 B
C
35 lines
664 B
C
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
|
|
//
|
|
//
|
|
//
|
|
//
|