#ifndef SYMTAB_H_INCLUDED #define SYMTAB_H_INCLUDED #include "value.hpp" struct symrec { char *name; /* name of symbol */ int type; /* type of symbol: either VAR or FNCT */ value var; union { value (*fnctptr)(const value &); /* value of a FNCT */ value (*fnctptr2)(const value &,const value &); /* value of a bin FNCT*/ value (*procptr)(void); /* value of a proc */ char *body; /* function body */ } ivalue; struct symrec *next; /* link field */ }; typedef struct symrec symrec; /* The symbol table: a chain of truct symrec'. */ extern symrec *sym_table; symrec * putsym(char *sym_name,int sym_type); symrec * getsym(char *sym_name); symrec * getsym(char *sym_name,int); void init_table(void); value evaluate(const symrec *); value evaluate(const symrec *,const value &); value evaluate(const symrec *,const value &,const value &); value evaluate_n(const symrec *,const valuematrix &); int arguments(const symrec *); // returns max number of arguments #endif