summarylogtreecommitdiffstats
path: root/tau.js
blob: f26de1f1c292f8e89cdd9513ff0e2d499d10bf89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
process = require('node:process');
pl = require('tau-prolog');
require("tau-prolog/modules/lists")(pl);
s = pl.create();
s.consult(process.argv[2], {
    success: function() {
        s.query(process.argv[3], {
            success: function(goal) {
                console.log(goal);
                s.answer({
                    success: function(answer) { console.log(answer); },
                    error:   function(err) { throw new Error(err); },
                    fail:    function() { console.log(false); },
                    limit:   function() { throw new Error("limit"); }
                });
            },
            error: function(err) { throw new Error(err); }
        });
    },
    error: function(err) { throw new Error(err); }
});