16

Do you know of any good javascript library for logic programming?

I'm interested in something like jsprolog, but I want to use javascript to communicate with the lib, and not a different language (such as prolog in this case).

Many thanks.

ivo
  • 4,101
  • 5
  • 33
  • 42
  • 1
    Have you looked at Python? It has a syntax very similar (IMO a bit more readable) than that language you linked to, and there are JS implementations of a subset of Python. – Blender Sep 28 '11 at 15:51
  • 2
    Not sure I have explained myself clearly enough. Extracting the meaning of what I tried to say: Desired paradigm: logic programming; Desired language: javascript; Desired syntax: javascript. – ivo Oct 09 '11 at 17:48
  • See this related discussion about JavaScript implementations of Prolog: http://stackoverflow.com/questions/15435462/prolog-systems-in-javascript – Anderson Green Mar 16 '15 at 21:03
  • 1
    @try-catch-finally As far as I know, these operators do not provide [logic programming](https://en.wikipedia.org/wiki/Logic_programming) features in JavaScript. – Anderson Green Sep 26 '16 at 02:19

4 Answers4

4

In addition to jsprolog, there are several JavaScript libraries for logic programming:

Of course, there are also several C++ libraries for logic programming that could be automatically ported into JavaScript using Emscripten.

Anderson Green
  • 30,230
  • 67
  • 195
  • 328
2

Please check out (JSL) https://www.npmjs.com/package/lib-jsl.

From the overview document, JSL is a JSON based logic programming library meant for embedded use in JS programs. It uses JSON as its syntax as well as I/O method

David Ansermot
  • 6,052
  • 8
  • 47
  • 82
2

There are a bunch of other languages that compile to javascript: https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

It is possible (although not probable!) one of those has a javascript friendly API AND a suitable library that can by "compiled" into JavaScript.

Exactly what you aren't looking for, and probably a time waster :)

robocat
  • 5,293
  • 48
  • 65
1

There is a new tool, a generic compiler adding any effect to JS, including logic programming, there is an example of prolog append: https://github.com/awto/mfjs-samples/tree/master/unify

user1686250
  • 815
  • 7
  • 10