enum type_kind {undefined_type, integer_type, boolean_type};

struct type_pair {
     char *name;
     type_kind type;

     type_pair(char *n, type_kind t) {
        name = n;
        type = t;
     }
};

struct list_pair {
     type_pair *head;
     list_pair *tail;

     list_pair ( char *name, type_kind type, list_pair *t) {
          head = new type_pair(name, type);
          tail = t;
     }
     list_pair(list_pair *t) { // useful for the scope markers
          head = 0;
          tail = t;
     }
};

typedef list_pair *type_pair_list;

class table {
     type_pair_list l; // the rep. for a table is a linked list of type_pairs
  public:
     void enter_symbol (const char *name, type_kind type);
     type_kind find_symbol (char * name);
     void enter_scope();
     void exit_scope();
     table() { // constructor for a table
        l = 0;
        enter_symbol("integer", integer_type);
        enter_symbol("boolean", boolean_type);
        enter_symbol("true", boolean_type);
        enter_symbol("false", boolean_type);
     }
};

type_kind type_check(int op, type_kind left, type_kind right);

