public static void runFromPlugin(Model m, String dir, String fn, ArrayList<ASTNode<?>> entries) { awaitId = 0; PrologBackend prologBE = null; try { prologBE = new PrologBackend(m, dir, fn, entries); prologBE.generateProlog(); } catch (Exception e) { System.err.println("Error in Prolog backend: " + e.getMessage()); } finally { if (prologBE != null && prologBE.outStream != null) prologBE.outStream.close(); } }
public static void runFromShell(final String[] args) { awaitId = 0; PrologBackend prologBE = null; try { prologBE = new PrologBackend(args); prologBE.generateProlog(); if (Arrays.asList(args).contains("-v")) System.out.println( "ABS file parsed to Prolog terms in " + prologBE.outFile.getAbsolutePath()); } catch (NotImplementedYetException e) { System.err.println(e.getMessage()); } catch (Exception e) { if (Arrays.asList(args).contains("-v")) { System.err.println("An error occurred during compilation:\n" + e.getMessage()); e.printStackTrace(); } // System.exit(1); } finally { if (prologBE != null && prologBE.outStream != null) prologBE.outStream.close(); } }