tau-prolog | An open source Prolog interpreter in JavaScript | Interpreter library
kandi X-RAY | tau-prolog Summary
kandi X-RAY | tau-prolog Summary
An open source Prolog interpreter in JavaScript
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Parses an expression .
- Define properties for this type
- Convert a condition into a closure function .
- Parse a program
- Creates a new Session object
- Parse Program .
- Parses a rule .
- Parse a query .
- Convert a grammar into a dictionary .
- Parses an expression .
tau-prolog Key Features
tau-prolog Examples and Code Snippets
Community Discussions
Trending Discussions on tau-prolog
QUESTION
I want to use Tau Prolog together with JavaScript on a Node Server, following this tutorial, which works well. I need to convert the answers in a JavaScript compatible format, especially lists to arrays, or objects and vice versa.
I changed the Prolog program and goal in a way that it returns a list
Program: test(t, [64,65,100,120]).
Goal: test(t, X).
which returns with
...ANSWER
Answered 2021-Dec-20 at 12:28Just for completeness, I replicate this answer here.
You can write a function to transform Prolog lists to arrays:
QUESTION
I'm currently trying to implement some basic Prolog queries in Tau-Prolog. Although I have working queries in SWI-Prolog, I can't implement them to work in Tau-Prolog. I would like to return the name of all Robots that are in the database and have the Interface "B". Is there something important I am missing here? I think that sub_string/5 might be the reason why it's not working. It also won't work when I paste the Code into the trial interpreter on http://tau-prolog.org/
Does anyone know a way to fix this query so it could work in Tau-Prolog? Thanks in advance!
...ANSWER
Answered 2020-Apr-04 at 19:30Use sub_atom/5
instead of sub_string/5
in the definition of the queryRwB
variable as you use atoms, not strings, in the definition of the predicate robot/4
:
QUESTION
I'm fairly new to Tau-Prolog and Javascript. At the beginning I would like to show some results computed by the Tau-Prolog engine in a Browser.
So far, all I want to show is some information contained in my Prolog-database:
All robots in the database and the interface to connect with a gripper/sensor etc.
All grippers/sensors in the database and the interface to connect to the robot.
The prolog-output would be something like: "Robot A fits with Gripper C (Same interface Z)." I've programmed this in SWI-Prolog and it works fine so far.
Now I would like to show the results in a HTML-Element:
...ANSWER
Answered 2020-Apr-02 at 11:25Just an example of handling multiple result, I crafted it creating a page 'tau-prolog.html' in the same folder where had downloaded 'tau-prolog.js', and opened locally in my browser. Then using the developer tools (console, debugger) had a look at inner workings of Tau Prolog.
Beware of details, like
- how do you load the Prolog file? in my example I opted for the simpler way, passing the 'program' into a string
- how do you start the interaction with the interpreter?
in my example I opted for a button, and the most basic handler onclick="..."
that loops to extract all answers. Clearly not appropriate for every scenario, but it illustrate the peculiar recursion that Javascript allows. Specially note that the variable
session
remain in scope among calls. - when you get an answer, only then the callback can decide if looping or quitting...
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tau-prolog
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page