I am looking for a version of prolog that can be run in JavaScript in a browser. That is I want to be able to use prolog to embed logical operations in a javascript web application
-
7A very interesting question, originally asked by false over here. (Notice that questions that are not of the form "How do I do X?" are considered "not constructive" on SO.)Wouter Beek– Wouter Beek2015-03-22 16:10:18 +00:00Commented Mar 22, 2015 at 16:10
-
1Just to mention "javascript" is probably not enough to narrow it down. Here's a question about executing a shell command from javascript. If you can do that, then you could execute a Prolog interpreter. But most or all of the concerns and conditions mentioned in the linked question/answers apply.lurker– lurker2015-03-22 17:05:09 +00:00Commented Mar 22, 2015 at 17:05
-
6How about Pengines? pengines.swi-prolog.org/docs/index.html Not exactly what you are looking for but should be able to do the job...user1812457– user18124572015-03-22 17:30:31 +00:00Commented Mar 22, 2015 at 17:30
-
1As Boris states, Pengines would probably be your best bet.Oskar– Oskar2015-04-08 12:54:24 +00:00Commented Apr 8, 2015 at 12:54
Add a comment
|
1 Answer
It's relatively easy to implement a prolog-like in languages that support generators. If you can use es6, you might find the implementation here interesting: https://curiosity-driven.org/prolog-interpreter
The first example of this I came across only worked on firefox but was called yield prolog: http://yieldprolog.sourceforge.net/