public void generate_db(String path, String pack) throws IOException {
        List<TypingRule> rs = toTypingRules(G);
        Generator g = new Generator(t, d, e, dchi, pack);
        // generate interface for nts
        for (TypingRule r : rs) {
            g.en_d_L(r.conseq.e, S.state, S.rType, S.valueTypeFuncRaw, S.name).writeToFile(path);
            g.en_d_eq_axiom(r.conseq.e, /*S.state[0].type, */S.valueTypeFuncRaw).writeToFile(path);
        }
        ds = new Class[rs.size()];
        int i = 0;
        // generate ast node for productions
        for (TypingRule r : rs) {
            (ds[i++] = g.en_d_L(r, S.state, S.rType, S.valueTypeFuncRaw)).writeToFile(path);
        }
        for (TypingRule r : rs) {
            g.en_e_L(r).writeToFile(path);
        }
        g.en_e_F().writeToFile(path);
        g.en_e_F2().writeToFile(path);
        g.en_e_F3().writeToFile(path);
        g.en_e_ID().writeToFile(path);
        g.en_e_Bot().writeToFile(path);
        g.enc_d_Visitor(S.state, S.rType, S.valueTypeFuncRaw, ds).writeToFile(path);
    }