Quick formatting updates

This commit is contained in:
Scarlett
2025-03-25 17:02:14 -04:00
parent d817ceaf7d
commit 94b80b024d
5 changed files with 532 additions and 505 deletions

View File

@ -5,9 +5,9 @@
struct TableNode;
typedef struct{
int size;
}primitive_info;
typedef struct {
int size;
} primitive_info;
/*This structure can be subsumed into the structure below (1-d array of chars)
typedef struct{
@ -17,86 +17,87 @@ typedef struct{
}string_info;
*/
typedef struct{
int numofdimensions;
//the above value tells you how long the below array is. For example if num of dimensions is 5, I can store 1,3,2,5,9 to define > int* arr;
//shouldn't need to store any values (like sizes of dimenions or the location
//int* sizesofdimensions;
//do have to store type of array
struct TableNode* typeofarray;
}array_info;
typedef struct {
int numofdimensions;
// the above value tells you how long the below array is. For example if
// num of dimensions is 5, I can store 1,3,2,5,9 to define > int*
// arr; shouldn't need to store any values (like sizes of dimenions or
// the location int* sizesofdimensions; do have to store type of array
struct TableNode *typeofarray;
} array_info;
typedef struct{
//similar to above we define a record to hold the number of elements and an array of tablenodes (types) that it contains in the >
int numofelements;
struct TableNode* listoftypes;
}record_info;
typedef struct {
// similar to above we define a record to hold the number of elements
// and an array of tablenodes (types) that it contains in the >
int numofelements;
struct TableNode *listoftypes;
} record_info;
typedef struct{
int startlinenumber;
bool regularoras;
}function_declaration_info;
typedef struct {
int startlinenumber;
bool regularoras;
} function_declaration_info;
typedef struct{
struct TableNode* parameter;
struct TableNode* returntype;
}function_type_info;
typedef struct {
struct TableNode *parameter;
struct TableNode *returntype;
} function_type_info;
typedef union {
primitive_info* PrimAdInfo;
array_info* ArrayAdInfo;
record_info* RecAdInfo;
//string_info* StringAdInfo;
function_declaration_info* FunDecAdInfo;
function_type_info* FunTypeAdInfo;
}AdInfo;
primitive_info *PrimAdInfo;
array_info *ArrayAdInfo;
record_info *RecAdInfo;
// string_info* StringAdInfo;
function_declaration_info *FunDecAdInfo;
function_type_info *FunTypeAdInfo;
} AdInfo;
typedef struct ListOfTable {
struct SymbolTable* table;
struct SymbolTable *table;
// struct ListOfTable* prev;
struct ListOfTable* next;
struct ListOfTable *next;
} ListOfTable;
typedef struct TableNode {
//reference to the type entry that this is
struct TableNode* theType;
char* theName;
AdInfo* additionalinfo;
struct TableNode* next;
}TableNode;
// reference to the type entry that this is
struct TableNode *theType;
char *theName;
AdInfo *additionalinfo;
struct TableNode *next;
} TableNode;
typedef struct SymbolTable {
TableNode* entries;
struct SymbolTable* Parent_Scope;
struct ListOfTable* Children_Scope;
TableNode *entries;
struct SymbolTable *Parent_Scope;
struct ListOfTable *Children_Scope;
int Line_Number;
int Column_Number;
} SymbolTable;
SymbolTable* CreateScope(SymbolTable* ParentScope, int Line, int Column);
TableNode* table_lookup(SymbolTable* table, char* x);
TableNode* look_up(SymbolTable* table, char* x);
void print_symbol_table(SymbolTable* table, FILE* file_ptr);
SymbolTable *CreateScope(SymbolTable *ParentScope, int Line, int Column);
TableNode *table_lookup(SymbolTable *table, char *x);
TableNode *look_up(SymbolTable *table, char *x);
void print_symbol_table(SymbolTable *table, FILE *file_ptr);
SymbolTable* getAncestor(SymbolTable* table);
SymbolTable* getParent(SymbolTable* st);
ListOfTable* getChildren(SymbolTable* st);
SymbolTable* getFirstChild(ListOfTable* lt);
ListOfTable* getRestOfChildren(ListOfTable* lt);
TableNode* getFirstEntry(SymbolTable* st);
TableNode* getNextEntry(TableNode* tn);
SymbolTable* init(SymbolTable* scope);
int getPrimSize(TableNode* definition);
int getNumArrDim(TableNode* definition);
TableNode* getArrType(TableNode* definition);
int getRecLength(TableNode* definition);
TableNode* getRecList(TableNode* definition);
int getStartLine(TableNode* definition);
bool getAsKeyword(TableNode* definition);
TableNode* getParameter(TableNode* definition);
TableNode* getReturn(TableNode* definition);
SymbolTable *getAncestor(SymbolTable *table);
SymbolTable *getParent(SymbolTable *st);
ListOfTable *getChildren(SymbolTable *st);
SymbolTable *getFirstChild(ListOfTable *lt);
ListOfTable *getRestOfChildren(ListOfTable *lt);
TableNode *getFirstEntry(SymbolTable *st);
TableNode *getNextEntry(TableNode *tn);
SymbolTable *init(SymbolTable *scope);
int getPrimSize(TableNode *definition);
int getNumArrDim(TableNode *definition);
TableNode *getArrType(TableNode *definition);
int getRecLength(TableNode *definition);
TableNode *getRecList(TableNode *definition);
int getStartLine(TableNode *definition);
bool getAsKeyword(TableNode *definition);
TableNode *getParameter(TableNode *definition);
TableNode *getReturn(TableNode *definition);
char* getType(TableNode* tn);
char* getName(TableNode* tn);
int getLine(SymbolTable* st);
int getColumn(SymbolTable* st);
char *getType(TableNode *tn);
char *getName(TableNode *tn);
int getLine(SymbolTable *st);
int getColumn(SymbolTable *st);