| static Symbol *symlist = 0; /* symbol table: linked list */ |
| lookup(char* s) /* find s in symbol table */ |
| for (sp = symlist; sp != (Symbol *) 0; sp = sp->next) |
| if (strcmp(sp->name, s) == 0) |
| return 0; /* 0 ==> not found */ |
| install(char* s, int t, double d) /* install s in symbol table */ |
| sp = emalloc(sizeof(Symbol)); |
| sp->name = emalloc(strlen(s)+1); /* +1 for '\0' */ |
| sp->next = symlist; /* put at front of list */ |
| emalloc(unsigned n) /* check return from malloc */ |
| execerror("out of memory", (char *) 0); |
| formallist(Symbol *formal, Formal *list) /* add formal to list */ |
| f = emalloc(sizeof(Formal)); |