5

Please, someone help me with an example. I would like to create a simple Prolog program, that adds two numbers together, and the Java program writes it to the console! So the Prolog is adding, and the a Java program is writing the result. I can write the adding in prolog, but I don't know how to invoke the prolog program in java. =( Please, someone, who can create this little example, write it here! Thanks!!

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
victorio
  • 6,224
  • 24
  • 77
  • 113
  • 1
    Does this answer your question? [How use Prolog from Java?](https://stackoverflow.com/questions/4303931/how-use-prolog-from-java) – newuser Jun 28 '20 at 09:34

4 Answers4

4

You can try to use the the GNU Prolog for Java. Running an existing prolog file appears straight-forward described here. I haven't tried myself, but would be interested to see if it works.

Garrett Hall
  • 29,524
  • 10
  • 61
  • 76
3

The easiest way I have found to use Prolog from Java is to use tuProlog which is a Prolog implementation in Java. http://www.alice.unibo.it/xwiki/bin/view/Tuprolog/ It is actively developed.

Unfortunately, tuProlog's performance is not as good as some much faster native Prologs (e.g. Yap,etc), so if speed is a concern, this might not work out for you.

Mark Bolusmjak
  • 23,606
  • 10
  • 74
  • 129
2

Consider X-Prolog which is pretty evolved and quite fast.

false
  • 10,264
  • 13
  • 101
  • 209
1

also there is open source JProl library which can be use for Prolog learning

Igor Maznitsa
  • 833
  • 7
  • 12