summaryrefslogtreecommitdiff
path: root/examples/api/java/PipedInput.java
diff options
context:
space:
mode:
Diffstat (limited to 'examples/api/java/PipedInput.java')
-rw-r--r--examples/api/java/PipedInput.java66
1 files changed, 0 insertions, 66 deletions
diff --git a/examples/api/java/PipedInput.java b/examples/api/java/PipedInput.java
deleted file mode 100644
index db6c1f902..000000000
--- a/examples/api/java/PipedInput.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/******************************************************************************
- * Top contributors (to current version):
- * Morgan Deters, Andres Noetzli
- *
- * This file is part of the cvc5 project.
- *
- * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
- * in the top-level source directory and their institutional affiliations.
- * All rights reserved. See the file COPYING in the top-level source
- * directory for licensing information.
- * ****************************************************************************
- *
- * A simple demonstration of the input parsing capabilities of CVC4 when
- * used from Java.
- */
-
-import edu.stanford.CVC4.*;
-import java.io.*;
-
-public class PipedInput {
- public static void main(String[] args) throws IOException {
- System.loadLibrary("cvc4jni");
-
- // Boilerplate setup for CVC4
- ExprManager exprMgr = new ExprManager();
- SmtEngine smt = new SmtEngine(exprMgr);
- smt.setOption("output-language", new SExpr("smt2"));
-
- // Set up a pair of connected Java streams
- PipedOutputStream solverPipe = new PipedOutputStream();
- PrintWriter toSolver = new PrintWriter(solverPipe);
- PipedInputStream stream = new PipedInputStream(solverPipe);
-
- // Write some things to CVC4's input stream, making sure to flush()
- toSolver.println("(set-logic QF_LIA)");
- toSolver.println("(declare-fun x () Int)");
- toSolver.println("(assert (= x 5))");
- toSolver.println("(check-sat)");
- toSolver.flush();
-
- // Set up the CVC4 parser
- ParserBuilder pbuilder =
- new ParserBuilder(exprMgr, "<string 1>")
- .withInputLanguage(InputLanguage.INPUT_LANG_SMTLIB_V2)
- .withLineBufferedStreamInput((java.io.InputStream)stream);
- Parser parser = pbuilder.build();
-
- // Read all the commands thus far
- Command cmd;
- while((cmd = parser.nextCommand()) != null) {
- System.out.println(cmd);
- cmd.invoke(smt, System.out);
- }
-
- // Write some more things to CVC4's input stream, making sure to flush()
- toSolver.println("(assert (= x 10))");
- toSolver.println("(check-sat)");
- toSolver.flush();
-
- // Read all the commands thus far
- while((cmd = parser.nextCommand()) != null) {
- System.out.println(cmd);
- cmd.invoke(smt, System.out);
- }
- }
-}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback