17

Javascript seems to become popular as an implementation language for other programming languages. The article Lightweight compilation of (C)LP to JavaScript. ICLP 2012 drew my attention on this.

There are a lot of proof-of-concept prototypes for Prolog systems written in Javascript around on the Web.

What are current, actively maintained, preferably ISO conforming Prolog systems written in Javascript?

Erik Kaplun
  • 37,128
  • 15
  • 99
  • 111
false
  • 10,264
  • 13
  • 101
  • 209
  • 2
    This question seems to be a poll and is therefore not suitable for SO. – Felix Kling Mar 15 '13 at 14:54
  • @FelixKling: There are similar questions for other languages: Like http://stackoverflow.com/questions/1817010/embedded-prolog-interpreter-compiler-for-java/6591847#6591847 – false Mar 15 '13 at 14:55
  • 5
    This was back in 2009... rules were different back then. – Felix Kling Mar 15 '13 at 14:56
  • 3
    [Asm.js](http://ejohn.org/blog/asmjs-javascript-compile-target/) could help bringing raw performance to this topic – CapelliC May 30 '13 at 09:05

1 Answers1

14

The only Prolog in JavaScript I know is YieldProlog, but I haven't tried it extensively, just the code available in QueryEditor.

I was hoping than using the yield construct it was lightweight (I used extensively such construct in C#, and I found it - paired to lambda - rather powerful).

But when I inspected (summarily) the source, I found it really complex, despite the assumptions.

edit

I've found recently these contributions, that seem really interesting: proscript and proscript2.

edit

a new implementation available:

Tau Prolog, brought to my attention from Jan on SWI mailing list

edit

Something new, hhprolog, a pure Prolog engine, based on code and documentation provided by Paul Tarau, ported by me to Javascript. So, available in both browsers and NodeJS.

The project is still preliminary, mostly needed is to bootstrap to interpreter: right now (pre)compiling Prolog to the (novel) virtual machine must be accomplished with SWI-Prolog installed, properly configured (JPL needed).

To implement such bootstrapping, I would probably need to implement negation, to reuse Paul' interface, or - better - attempt to implement something staying in the pure paradigm. In particular, only unbounded integer arithmetic (again by Paul Tarau, there is some Python code available - I will try lazily to port to Javascript).

Community
  • 1
  • 1
CapelliC
  • 59,646
  • 5
  • 47
  • 90
  • Can you explain me what "Yield Prolog lets you embed Prolog programs directly in Python, C# [1] or Javascript" actually means? Are these 3 languages? Or what? – false Mar 15 '13 at 19:43
  • 2
    I think it 'compiles' clauses: the [docs](http://yieldprolog.sourceforge.net/tutorial_toc.html) pages are extensive... – CapelliC Mar 15 '13 at 20:22
  • 1
    Yield Prolog appears to be compatible with the latest version of Firefox, but not Google Chrome. Fortunately, there are [several other logic programming systems](http://stackoverflow.com/questions/7585903/javascript-library-for-logic-programming) that have been implemented in JavaScript. – Anderson Green Sep 28 '16 at 06:21