prolog.js
October 25, 2015 ยท View on GitHub
Prolog parser, compiler and interpreter in Javascript
Status
Features
- No server-code required
- Fact
- Rule
- Cut operator
! - Conjunction
,and disjunction; trueandfalseboolean- Operators (for more details, please see
lexer.jsis+,-,*and/arithmetic operators=unification=:=,=\=,>,<,=<and>=arithmetic operators+,-andnotunary operators
builtinandusernamespaces- But no builtin facts or rules are provided out-of-the-box
- List with
|tail operator ?-unary operatorfail
?- operator
The query operator is not standard in prolog source code. It is provided as convenience and used in the online demo.
DEMO
The demo can be accessed through here.
Javascript bridge
The compiler can be fed directly with Javascript objects. The classes Functor and Token can be used for this purpose.
To understand how to construct "sentences" using these objects, I would encourage looking at the /tests and experimenting with
Prolog.parse_per_sentence.
Contact
For more information, please contact Jean-Lou Dupont on G+.