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
Asked
Active
Viewed 3,508 times
7
-
7A very interesting question, originally asked by [false](http://stackoverflow.com/users/772868/false) [over here](http://stackoverflow.com/questions/15435462/prolog-systems-in-javascript). (Notice that questions that are not of the form "How do I do X?" are considered "not constructive" on SO.) – Wouter Beek Mar 22 '15 at 16:10
-
1Just to mention "javascript" is probably not enough to narrow it down. [Here's a question](http://stackoverflow.com/questions/1880198/how-to-execute-shell-command-in-javascript) 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 Mar 22 '15 at 17:05
-
6How about Pengines? http://pengines.swi-prolog.org/docs/index.html Not exactly what you are looking for but should be able to do the job... – Mar 22 '15 at 17:30
-
1As Boris states, Pengines would probably be your best bet. – Oskar Apr 08 '15 at 12:54
1 Answers
3
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/

kybernetikos
- 8,281
- 1
- 46
- 54