fixed print symbol table and added primitive types

This commit is contained in:
Partho
2025-04-11 16:37:57 -04:00
parent 55bc098de5
commit e8bad44949

View File

@ -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 {