#ifndef _token_h #define _token_h /* Kinds of symbols encountered while parsing an arithmetic expression */ enum symbol {NUMBER, PLUS, MINUS, TIMES, DIVIDE, L_PAREN, R_PAREN, EOL, UNDEF} ; /* Data structure for a token */ typedef struct { enum symbol kind ; int value ; } token_t ; /* Data structure for input string */ #define BUFLEN 256 typedef struct { char str[BUFLEN] ; /* input string */ int pos ; /* current position */ int last ; /* last position */ int looked ; /* = 1, if looked ahead. = 0, otherwise */ int lookahead_pos ; /* stopped scanning here, after looking */ token_t lookahead ; } input_t ; /* Support functions */ input_t *ReadInput(void) ; void EatToken(input_t *) ; token_t LookAhead(input_t *) ; void PrintError(input_t *) ; #endif