Реферат: Системное программное обеспечение
NAME, NUMBER, END,
PLUS = '+', MINUS = '-', MUL='*', DIV='/',
PRINT=';', ASSIGN='=', LP='(', RP=')'
};
token_value curr_tok;
struct name {
char* string;
name* next;
double value;
};
const TBLSZ = 23;
name* table[TBLSZ];
int no_of_errors;
double error(char* s) {
cerr << "error: " << s << "\n";
no_of_errors++;
return 1;
}
name* look(char* p, int ins = 0)
{
int ii= 0;
char *pp = p;
while (*pp) ii = ii<<1 ^ *pp++;
if (ii < 0) ii = -ii;
ii %= TBLSZ;
for (name* n=table [ii]; n; n=n->next)
if (strcmp(p,n->string) == 0) return n;
if (ins == 0) error("name not found");
name* nn = new name;