I'm making an AI project which uses prolog, but I want it to be publish online. I've found pengines (http://pengines.swi-prolog.org/docs/documentation.html, http://www.swi-prolog.org/pldoc/doc_for?object=section(%27packages/pengines.html%27)) which is supposed to be a javascript implementation of Prolog, but I can't seem to understand how to use it.
I've tried using the the pengines npm package (https://www.npmjs.com/package/pengines) and running the code from the pengines docs with the default express-generator app:
<html lang="en">
<head>
<script src="/vendor/jquery/jquery-2.0.3.min.js"></script>
<script src="/pengine/pengines.js"></script>
<script type="text/x-prolog">
main :-
repeat,
pengine_input(X),
pengine_output(X),
X == stop.
</script>
<script>
var pengine = new Pengine({
oncreate: handleCreate,
onprompt: handlePrompt,
onoutput: handleOutput
});
function handleCreate() {
pengine.ask('main');
}
function handlePrompt() {
pengine.input(prompt(this.data));
}
function handleOutput() {
$('#out').html(this.data);
}
</script>
</head>
<body>
<div id="out"></div>
</body>
But it only returns an error:
http://localhost:3000/pengine/create Failed to load resource: the server responded with a status of 404 (Not Found)
I would be very thankful if someone could explain how to work with pengines or another prolog implementation in javascript.
Thanks!