working on make sure types pass properly in grammar

This commit is contained in:
Partho
2025-04-11 14:02:34 -04:00
parent 413a4854b4
commit f6dabd8d03
2 changed files with 11 additions and 10 deletions

View File

@ -1124,11 +1124,11 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
}
if (getAdInfoType(entry) == TYPE_RECORD_TYPE) {
char *recordAdInfo = (char *)malloc(100);
sprintf(recordAdInfo, " elements-%d", getRecLength(entry));
sprintf(recordAdInfo, " elements-%d size-%d bytes", getRecLength(entry), getRecTotal(entry));
if (parentScopeNum == 0) {
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, "record type", recordAdInfo);
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, " record type", recordAdInfo);
} else {
st_fprint(file_ptr, getName(entry), currentScopeNum, parentScopeNum, "record type", recordAdInfo);
st_fprint(file_ptr, getName(entry), currentScopeNum, parentScopeNum, " record type", recordAdInfo);
}
}
@ -1136,15 +1136,15 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
char *recordAdInfo = (char *)malloc(100);
sprintf(recordAdInfo, " elements-%d", getRecLength(entry));
if (parentScopeNum == 0) {
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, "record instance", recordAdInfo);
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, getType(entry), "record instance");
} else {
st_fprint(file_ptr, getName(entry), currentScopeNum, parentScopeNum, "record instance", recordAdInfo);
st_fprint(file_ptr, getName(entry), currentScopeNum, parentScopeNum, getType(entry), "record instance");
}
}
if (getAdInfoType(entry) == TYPE_PRIMITIVE) {
char *primAdInfo = (char *)malloc(100);
sprintf(primAdInfo, " size-%d bytes", getPrimSize(entry));
sprintf(primAdInfo, " size-%d bytes", getPrimSize(getTypeEntry(entry)));
if (parentScopeNum == 0) {
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, " Primitive", primAdInfo);
} else {
@ -1169,9 +1169,9 @@ void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
if (getAdInfoType(entry) == TYPE_FUNCTION_DECLARATION) {
if (parentScopeNum == 0) {
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, " Function", " Function Declaration");
st_fprint(file_ptr, getName(entry), currentScopeNum, -100, getType(entry), " Function Definition");
} else {
st_fprint(file_ptr, getName(entry), currentScopeNum, parentScopeNum, " Function", " Function Declaration");
st_fprint(file_ptr, getName(entry), currentScopeNum, parentScopeNum, getType(entry), " Function Definition");
}
}