use of edu.mit.csail.sdg.ast.Module in project org.alloytools.alloy by AlloyTools.
the class SimpleGUI method doShowParseTree.
/**
* This method displays the parse tree.
*/
private Runner doShowParseTree() {
if (wrap)
return wrapMe();
doRefreshRun();
OurUtil.enableAll(runmenu);
if (commands != null) {
Module world = null;
try {
int resolutionMode = (Version.experimental && ImplicitThis.get()) ? 2 : 1;
A4Options opt = new A4Options();
opt.tempDirectory = alloyHome() + fs + "tmp";
opt.solverDirectory = alloyHome() + fs + "binary";
opt.originalFilename = Util.canon(text.get().getFilename());
world = CompUtil.parseEverything_fromFile(A4Reporter.NOP, text.takeSnapshot(), opt.originalFilename, resolutionMode);
} catch (Err er) {
text.shade(er.pos);
log.logRed(er.toString() + "\n\n");
return null;
}
world.showAsTree(this);
}
return null;
}
use of edu.mit.csail.sdg.ast.Module in project org.alloytools.alloy by AlloyTools.
the class InternalTest method main2.
/**
* Displays the amount of memory taken per solution enumeration.
*/
public static void main2(String[] args) throws Exception {
String filename = "models/examples/algorithms/dijkstra.als";
Module world = CompUtil.parseEverything_fromFile(A4Reporter.NOP, null, filename);
A4Options options = new A4Options();
for (Command command : world.getAllCommands()) {
A4Solution ans = TranslateAlloyToKodkod.execute_command(A4Reporter.NOP, world.getAllReachableSigs(), command, options);
while (ans.satisfiable()) {
String hc = "Answer: " + ans.toString().hashCode();
System.gc();
System.gc();
System.gc();
Thread.sleep(500);
System.gc();
System.gc();
System.gc();
Thread.sleep(500);
long t = Runtime.getRuntime().totalMemory(), f = Runtime.getRuntime().freeMemory(), m = Runtime.getRuntime().maxMemory();
System.out.println(hc + " total=" + t + " free=" + f + " max=" + m);
System.out.flush();
ans = ans.next();
}
return;
}
}
use of edu.mit.csail.sdg.ast.Module in project org.alloytools.alloy by AlloyTools.
the class AlloyTest method main.
public static void main(String[] args) throws Exception {
A4Reporter rep = new A4Reporter();
Module world = CompUtil.parseEverything_fromFile(rep, null, "/home/aleks/mvc.als");
A4Options options = new A4Options();
options.solver = A4Options.SatSolver.SAT4J;
options.skolemDepth = 1;
for (Command command : world.getAllCommands()) {
A4Solution ans = null;
try {
ans = TranslateAlloyToKodkod.execute_commandFromBook(rep, world.getAllReachableSigs(), command, options);
System.out.println(ans);
} catch (Err ex) {
Logger.getLogger(AlloyTest.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Aggregations