From e8bad449493a8ff8f0dbc667a79420a840ee3e8a Mon Sep 17 00:00:00 2001 From: Partho Date: Fri, 11 Apr 2025 16:37:57 -0400 Subject: [PATCH] fixed print symbol table and added primitive types --- src/symbol_table.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/symbol_table.c b/src/symbol_table.c index 60752bd..ae81eb8 100644 --- a/src/symbol_table.c +++ b/src/symbol_table.c @@ -692,11 +692,11 @@ SymbolTable *init(SymbolTable *start) { stri->additionalinfo = CreateArrayInfo(1, chara); boo->additionalinfo = CreatePrimitiveInfo(SIZE_BOOL); - integ->tag = TYPE_PRIMITIVE; // explicitly set the type for integ - addr->tag = TYPE_PRIMITIVE; // explicitly set the type for addr - chara->tag = TYPE_PRIMITIVE; // explicitly set the type for chara + integ->tag = TYPE_PRIMITIVE_TYPE; // explicitly set the type for integ + addr->tag = TYPE_PRIMITIVE_TYPE; // explicitly set the type for addr + chara->tag = TYPE_PRIMITIVE_TYPE; // explicitly set the type for chara stri->tag = TYPE_ARRAY_TYPE; // explicitly set the type for stri - boo->tag = TYPE_PRIMITIVE; // explicitly set the type for boo + boo->tag = TYPE_PRIMITIVE_TYPE; // explicitly set the type for boo // addr->additionalinfo = CreatePrimitiveInfo(8); start->Line_Number = 1; @@ -1144,7 +1144,7 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) { if (getAdInfoType(entry) == TYPE_PRIMITIVE_TYPE) { char *primAdInfo = (char *)malloc(100); - sprintf(primAdInfo, " size-%d bytes", getPrimSize(getTypeEntry(entry))); + sprintf(primAdInfo, " size-%d bytes", getPrimSize(entry)); if (parentScopeNum == 0) { st_fprint(file_ptr, getName(entry), currentScopeNum, -100, " Primitive Type", primAdInfo); } else {