00001 #ifndef UNIFY_H 00002 #define UNIFY_H 00003 00004 #include <map> 00005 #include <set> 00006 #include <string> 00007 00008 #include "parser-structs.h" 00009 #include "constraint.h" 00010 00011 using namespace std; 00012 00013 struct unifier 00014 { 00020 friend ostream &operator<<(ostream &os, const unifier *u); 00021 00025 ~unifier(); 00026 00030 static int count; 00031 00035 unifier(); 00036 00043 bool add_binding(const string &s, const c_term *t); 00044 00050 void apply_to(struct c_term *t, bool skip_renaming = false) const; 00051 00057 void apply_to(struct c_rule *r, bool skip_renaming = false) const; 00058 00063 void apply_to(con_type &c) const; 00064 00074 bool unify(const struct c_term *t1, const struct c_term *t2); 00075 00085 bool unify(const struct c_rule *r1, const struct c_rule *r2); 00086 00087 private: 00088 00089 map<string, c_term*> bindings; 00090 }; 00091 00092 #endif //UNIFY_H