Re: Pengine - the Prolog engine running SWISH
Michael Hendricks <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <CAFHuXub-idFUG1cgnz3GEVdACv7RqMBxMuaMnXU=84B7QviAxg@mail.gmail.com> |
On 08/16/2013 01:50 AM, Richard A. O'Keefe wrote: > My first reaction was "that's crazy". > My second reaction was, "you know, given emscripten and Asm.js, > that 'good Prolog engine written in Javascript' could *be* SWI Prolog". That's an intriguing idea. Our next quarterly roadmap at work requires us to run Prolog in the browser. We need solutions in well under 100ms, so network latency prevents server-side code. We had planned to write a dodgy Prolog interpreter in JavaScript (as we did with Go a few months back: https://github.com/mndrix/golog). However, if we could get a stripped down SWI-Prolog in the browser, we'd be very happy indeed. On Fri, Aug 16, 2013 at 1:34 AM, Jan Wielemaker <[email protected]> wrote: > How do you see that? The code base is unusable as JS asks for a > quite different design than C. A lot of the fun of SWI-Prolog comes > from its extensive libraries, many of which have C components. Of > course you can copy goodies from SWI-Prolog. There are more systems > with goodies to copy from though. > Once Emscripten has done it's work, it's fairly easy to call C functions from Javascript: https://github.com/kripken/emscripten/wiki/Interacting-with-code So at the lowest level, JS can call PL_open_query(), PL_next_solution(), etc. Eventually someone would wrap that in a pleasant JS API something like: // run callback for each solution to goal pl_query("foo(one, X)", function (solution) { if (solution["X"] == "two") { ... } }); -- Michael -------------- next part -------------- HTML attachment scrubbed and removed