Cleanup data, prepare for local vars
This commit is contained in:
parent
627839aa5d
commit
b540d5ef1b
|
@ -19,7 +19,6 @@ extern_ struct SymbolTable Symbols[SYMBOLS];
|
||||||
extern_ int TypeSizes[9];
|
extern_ int TypeSizes[9];
|
||||||
extern_ char* TypeNames[9];
|
extern_ char* TypeNames[9];
|
||||||
|
|
||||||
extern_ char* TokenStrings[];
|
|
||||||
extern_ char* TokenNames[];
|
extern_ char* TokenNames[];
|
||||||
|
|
||||||
extern_ int CurrentFunction;
|
extern_ int CurrentFunction;
|
||||||
|
@ -31,3 +30,6 @@ extern_ FILE* OutputFile;
|
||||||
|
|
||||||
extern_ struct Token CurrentToken;
|
extern_ struct Token CurrentToken;
|
||||||
extern_ char CurrentIdentifier[TEXTLEN + 1];
|
extern_ char CurrentIdentifier[TEXTLEN + 1];
|
||||||
|
|
||||||
|
extern_ int CurrentGlobal;
|
||||||
|
extern_ int CurrentLocal;
|
|
@ -196,6 +196,17 @@ struct SymbolTable {
|
||||||
int Structure; // An entry in StructureType - metadata on how to process the data
|
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 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 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.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
int TypeSizes[9] = { 0, 1, 4, 8, 0, 8, 8, 8, 8}; // in BYTES
|
int TypeSizes[9] = { 0, 1, 4, 8, 0, 8, 8, 8, 8}; // in BYTES
|
||||||
|
|
||||||
char* TokenStrings[] = { "+", "-", "*", "/", "int" };
|
|
||||||
char* TokenNames[] = {
|
char* TokenNames[] = {
|
||||||
"End of file",
|
"End of file",
|
||||||
"Equivalency",
|
"Equivalency",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user