Put the declarations in "data.h", because that header declares the types cost_t and token_p. Also #include <cgg_cg.h> from "data.h" to get types c3_p and set_p, and guard <cgg_cg.h> against multiple inclusion.
new clash-table in tables.c when possible, and some other tuning