use of catdata.aql.exp.AqlMultiDriver in project fql by CategoricalData.
the class AqlCodeEditor method makeEnv.
@Override
protected AqlEnv makeEnv(String str, Program<Exp<?>> init) {
driver = new AqlMultiDriver(init, toUpdate, last_env);
driver.start();
// constructor blocks
last_env = driver.env;
last_prog = init;
// topArea.forceReparsing(parser);
clearSpellCheck();
if (last_env.exn != null && last_env.defs.keySet().isEmpty()) {
throw last_env.exn;
}
return last_env;
}
use of catdata.aql.exp.AqlMultiDriver in project fql by CategoricalData.
the class AqlCmdLine method main.
public static void main(String[] args) {
try (FileReader r = new FileReader(args[0])) {
String str = Util.readFile(r);
Program<Exp<?>> prog = AqlParser.getParser().parseProgram(str);
String[] t = new String[1];
AqlMultiDriver driver = new AqlMultiDriver(prog, t, null);
driver.start();
AqlEnv last_env = driver.env;
if (last_env.exn != null) {
throw last_env.exn;
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of catdata.aql.exp.AqlMultiDriver in project fql by CategoricalData.
the class AqlTester method runMany.
private static Ctx<String, Throwable> runMany(Ctx<String, String> progs) {
Ctx<String, Throwable> result = new Ctx<>();
for (String k : progs.keySet()) {
try {
System.out.println(k);
Program<Exp<?>> prog = AqlParser.getParser().parseProgram(progs.get(k));
String[] toUpdate = new String[] { "" };
AqlMultiDriver driver = new AqlMultiDriver(prog, toUpdate, null);
// blocks
driver.start();
AqlEnv env = driver.env;
if (env.exn != null) {
result.put(k, env.exn);
}
} catch (Throwable ex) {
ex.printStackTrace();
result.put(k, ex);
}
}
return result;
}
use of catdata.aql.exp.AqlMultiDriver in project fql by CategoricalData.
the class CodyCmdLine method main.
// args[0] = input AQL program
// args[1] = directory for tptp output
public static void main(String[] args) {
try (FileReader r = new FileReader(args[0])) {
String str = Util.readFile(r);
Program<Exp<?>> prog = AqlParser.getParser().parseProgram(str);
// poll for driver status
String[] t = new String[1];
AqlMultiDriver driver = new AqlMultiDriver(prog, t, null);
// blocks
driver.start();
AqlEnv env = driver.env;
if (env.exn != null) {
throw env.exn;
}
File dir = new File(args[1]);
dir.mkdirs();
for (String k : env.defs.tys.keySet()) {
TypeSide<?, ?> ts = env.defs.tys.get(k);
File f = new File(dir, k + ".tptp");
// maedmax is unsound with empty sorts, but true here proceeds anyway
String s = ts.collage().toKB().tptp(true);
Util.writeFile(s, f.getAbsolutePath());
}
for (String k : env.defs.insts.keySet()) {
Instance ts = env.defs.insts.get(k);
File f = new File(dir, k + ".tptp");
// maedmax is unsound with empty sorts, but true here proceeds anyway
String s = ts.collage().toKB().tptp(true);
Util.writeFile(s, f.getAbsolutePath());
}
for (String k : env.defs.schs.keySet()) {
Schema ts = env.defs.schs.get(k);
File f = new File(dir, k + ".tptp");
// maedmax is unsound with empty sorts, but true here proceeds anyway
String s = ts.collage().toKB().tptp(true);
Util.writeFile(s, f.getAbsolutePath());
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations