working on tabel
This commit is contained in:
@ -44,7 +44,8 @@ typedef enum {
|
||||
// size
|
||||
TYPE_PRIMITIVE = 6,
|
||||
//likely NULL
|
||||
TYPE_ALL_ELSE = 7
|
||||
TYPE_ALL_ELSE = 7,
|
||||
TYPE_UNDEFINED = 8
|
||||
|
||||
} types;
|
||||
|
||||
@ -214,7 +215,13 @@ int getRecSize(SymbolTable* tn){
|
||||
}
|
||||
|
||||
// below function takes a bool to see if parameter should be decomposed or not
|
||||
// note that functions only take one input and have one output
|
||||
assignable:
|
||||
ID {$$ = $1; }
|
||||
| assignable ablock {$$ = getName(getReturn(look_up(cur, $1)));}
|
||||
| assignable rec_op ID {TableNode * tn; if(NULL != (tn = table_lookup(getRecList(look_up(cur, $1)), $3)))
|
||||
{$$ = getType(tn);}
|
||||
}
|
||||
;// note that functions only take one input and have one output
|
||||
// using "as" the input record can be decomposed to give the illusion of
|
||||
// multiple inputs Below function also has the line number where the function is
|
||||
// first defined
|
||||
@ -488,7 +495,10 @@ int getAdInfoType(TableNode* tn){
|
||||
if(strcmp(getType(tn),getName(arrayprim))==0){
|
||||
return TYPE_ARRAY;
|
||||
}
|
||||
else{
|
||||
if(strcmp(getType(tn),getName(undefined))==0){
|
||||
return TYPE_UNDEFINED;
|
||||
}
|
||||
else{
|
||||
return TYPE_FUNCTION_DECLARATION;
|
||||
}
|
||||
}
|
||||
@ -637,6 +647,7 @@ TableNode *look_up(SymbolTable *table, char *x) {
|
||||
|
||||
void print_symbol_table(SymbolTable *table, FILE *file_ptr) {
|
||||
|
||||
return;
|
||||
if (table->Parent_Scope == NULL) {
|
||||
fprintf(file_ptr, "%-17s: %-6s : %-6s : %-21s: %-28s\n", "NAME",
|
||||
"SCOPE", "PARENT", "TYPE", "Extra annotation");
|
||||
|
Reference in New Issue
Block a user