save point for tweaking symbol table--note won't be currently working

This commit is contained in:
Partho Bhattacharya
2025-03-14 04:24:03 -04:00
parent 3db6191969
commit f0e03b2724
2 changed files with 120 additions and 3 deletions

View File

@ -3,6 +3,44 @@
#include <stdlib.h>
#include <string.h>
typedef struct{
int size;
}primitive_info;
typedef struct{
int length;
char* location;
}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;
}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;
TableNode* listoftypes;
}record_info;
typedef struct{
int startlinenumber;
bool regularoras;
}function_declaration_info;
typedef struct{
TableNode* parameter;
TableNode* returntype;
}function_type_info;
typedef union {
PrimAdInfo* primitive_info;
ArrayAdInfo* array_info;
RecAdInfo* record_info;
StringAdInfo* string_info;
FunDecAdInfo* func_dec_info;
FunTypeAdInfo* func_type_info;
}AdInfo;
typedef struct ListOfTable {
struct SymbolTable* table;
// struct ListOfTable* prev;
@ -10,8 +48,10 @@ typedef struct ListOfTable {
} ListOfTable;
typedef struct TableNode {
char* theType;
//reference to the type entry that this is
TableNode* theType;
char* theName;
AdInfo* additionalinfo;
struct TableNode* next;
} TableNode;