Cleanup data, prepare for local vars

This commit is contained in:
Curle 2020-11-25 02:11:09 +00:00
parent 627839aa5d
commit b540d5ef1b
Signed by: TheCurle
GPG Key ID: 2F2E62F0DA69A5AE
3 changed files with 15 additions and 3 deletions

View File

@ -19,7 +19,6 @@ extern_ struct SymbolTable Symbols[SYMBOLS];
extern_ int TypeSizes[9];
extern_ char* TypeNames[9];
extern_ char* TokenStrings[];
extern_ char* TokenNames[];
extern_ int CurrentFunction;
@ -30,4 +29,7 @@ extern_ FILE* SourceFile;
extern_ FILE* OutputFile;
extern_ struct Token CurrentToken;
extern_ char CurrentIdentifier[TEXTLEN + 1];
extern_ char CurrentIdentifier[TEXTLEN + 1];
extern_ int CurrentGlobal;
extern_ int CurrentLocal;

View File

@ -196,6 +196,17 @@ struct SymbolTable {
int Structure; // An entry in StructureType - metadata on how to process the data
int EndLabel; // The number of the label to jump to, in order to exit this function (if applicable)
int Length; // The length of the symbol in units of 1 element -- the size of an array, for example.
int Storage; // The scope of this symbol - decides when it is discarded.
int SinkOffset; // How many times must we sink the rbp to get to this symbol in the stack?
};
enum StorageScope {
SC_GLOBAL = 1, // Global Scope
//SC_CLASS, // Class-local definitions
//SC_STATIC, // Static storage definitions
//SC_PARAM, // Function parameters
SC_LOCAL // Function-local scope.
// There is no deeper scope than function.
};

View File

@ -12,7 +12,6 @@
int TypeSizes[9] = { 0, 1, 4, 8, 0, 8, 8, 8, 8}; // in BYTES
char* TokenStrings[] = { "+", "-", "*", "/", "int" };
char* TokenNames[] = {
"End of file",
"Equivalency",