Is there any battle-tested way of declaring some (simple) prolog predicates and assert some facts, in javascript client code?
The best I could find is http://www.csse.monash.edu.au/~lloyd/tildeLogic/Prolog.toy/Ch/04.Techn1.shtml but looks like it’s calling some server-side “toy” interpreter.
The nice thing about Prolog is that it has a nice backtracking and unification engine built in the language itself. Javascript (as most languages, BTW) doesn’t have this, so there is no way to get Prolog-style functionality “for free”.
What you can do, of course, is write an interpreter for your subset of Prolog (or get it as a library from somewhere) and pass your predicates to it, encoded as some nice JS data structure.
But then, why would you want this at all? Do you need only backtracking? Do you need complex unification? Perhaps just writing a recursive search function would suffice? You question doesn’t give many details.