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