use of catdata.fql.sql.PSM in project fql by CategoricalData.
the class InstOps method visit.
@Override
public List<PSM> visit(String dst, Fst e) {
List<PSM> ret = new LinkedList<>();
InstExp k = prog.insts.get(e.obj);
Signature t = k.type(prog).toSig(prog);
for (Node n : t.nodes) {
ret.add(new InsertSQL(dst + "_" + n.string, new CopyFlower(e.obj + "_fst_" + n.string, "c0", "c1"), "c0", "c1"));
}
return ret;
}
use of catdata.fql.sql.PSM in project fql by CategoricalData.
the class InstOps method visit.
@Override
public List<PSM> visit(String env, TransEval e) {
List<PSM> ret = new LinkedList<>();
InstExp k = prog.insts.get(e.inst);
Times t = (Times) k;
InstExp v = prog.insts.get(t.a);
Exp i = (Exp) v;
ret.add(new PSMEval(env, i.a, i.b, t.a, e.inst, t.type(prog).toSig(prog)));
return ret;
}
use of catdata.fql.sql.PSM in project fql by CategoricalData.
the class InstOps method visit.
@Override
public List<PSM> visit(String dst, TransExp.Sigma e) {
List<PSM> ret = new LinkedList<>();
Pair<String, String> ht = e.h.type(prog);
Signature sig = prog.insts.get(ht.first).type(prog).toSig(prog);
Mapping F = ((Sigma) prog.insts.get(e.src)).F.toMap(prog);
String next = next();
ret.addAll(PSMGen.makeTables(next, sig, false));
ret.addAll(e.h.accept(next, this));
Signature sig2 = prog.insts.get(e.src).type(prog).toSig(prog);
String xxx = "sigfunc";
ret.addAll(PSMGen.makeTables(xxx, sig2, false));
for (Node n : sig2.nodes) {
List<Flower> l = new LinkedList<>();
for (Node m : F.source.nodes) {
if (F.nm.get(m).equals(n)) {
l.add(new CopyFlower(next + "_" + m.string, "c0", "c1"));
}
}
String yyy = xxx + "_" + n.string;
if (l.isEmpty()) {
ret.add(new InsertSQL(yyy, l.get(0), "c0", "c1"));
} else {
ret.add(new InsertSQL(yyy, new Union(l), "c0", "c1"));
}
ret.add(new InsertSQL(dst + "_" + n.string, PSMGen.compose(e.src + "_" + n.string + "_subst_inv", yyy, e.dst + "_" + n.string + "_subst"), "c0", "c1"));
}
ret.addAll(PSMGen.dropTables(xxx, sig2));
ret.addAll(PSMGen.dropTables(next, sig));
return ret;
}
use of catdata.fql.sql.PSM in project fql by CategoricalData.
the class InstOps method visit.
@Override
public List<PSM> visit(String env, Implies e) {
List<PSM> ret = new LinkedList<>();
Times pr = (Times) prog.insts.get(e.prop);
Signature sig = pr.type(prog).toSig(prog);
ret.add(new PSMAnd(sig, env, e.prop, pr.a, "implies"));
return ret;
}
use of catdata.fql.sql.PSM in project fql by CategoricalData.
the class InstOps method visit.
@Override
public Pair<List<PSM>, Object> visit(String dst, Exp e) {
List<PSM> ret = new LinkedList<>();
ret.add(new ExpPSM(dst, e.a, e.b, prog.insts.get(e.a).type(prog).toSig(prog)));
return new Pair<>(ret, new Object());
}
Aggregations