Send
Close Add comments:
(status displays here)
Got it! This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
tuprolog
1. tuprolog
2. TuProlog
The name "
tuprolog" appears to come originally from "
Tokyo University Prolog".
The home page is at
https://mvnrepository.com/artifact/it.unibo.alice.tuprolog/tuprolog/3.1 as of 2019-08-15.
The tuprolog software is Java-based (there is also a .NET version) so, for Java, one needs the
jar file and the correct Java command to run it. Java should already be installed. See
Java .
3. Download sites
4. Alternative download
An alternative download is from the YCP course site from Fall 2018 at the following link.
https://ycpcs.github.io/cs340-fall2018/lectures/lecture18.html
If you unzip this file to your home directory you should be able to use the commands below.
Otherwise, you need to change the path in your command to fit where you unzipped TuProlog.
5. IDE
There is a simple
IDE (
Integrated Development Environment) included with TuProlog. See page 58 of the PDF manual.
6. CentOS installation
Here is one way to download
tuprolog using commands.
The following Linux command(s) download tuprolog at the command line.
mkdir ~/tuprolog
cd ~/tuprolog
wget https://bitbucket.org/tuprologteam/tuprolog/downloads/2p-3.3.0.zip
unzip 2p-3.3.0.zip
cd ~/tuprolog/bin && ls -ls
The following is intended to be run as a Bash script and not typed in at the command line.
The following Linux command(s) download tuprolog in a Bash script.
IVER1=2p-3.3.0
if [ -f ~/tuprolog/bin/2p.jar ]; then
echo -e "tuprolog: 2p.jar exists, nothing done"
else
mkdir -p ~/tuprolog
cd ~/tuprolog
if [ -f "~/tuprolog/$IVER1.zip" ]; then
echo -e "tuprolog: $IVER1.zip exists, nothing done"
else
echo -e "tuprolog: $IVER1.zip does not exist. getting it"
wget https://bitbucket.org/tuprologteam/tuprolog/downloads/$IVER1.zip
fi
unzip $IVER1.zip
cd ~/tuprolog/bin && ls -ls
fi
The last command displays the
bin folder where
tuprolog.jar should now be located.
If the above worked, the
tuprolog.jar file should be as follows.
~/tuprolog/bin/tuprolog.jar
7. Installed version
I could not find a command or way to display the installed version of tuprolog.
8. Hello world in Prolog
The file type of a
Prolog program file is
pro.
The following Linux command(s) create/edit a hello program in the your home directory using the nano text editor.
nano ~/hello.pro
Create the following program text in the editor that will output the text "Hello world"
go:- print("Hello world!"), nl.
:- solve(go).
To exit with save, remember to press
Ctrl-X, then "
y" (for yes) and
Enter to exit.
The following Linux command(s) run the program.
java -cp ~/tuprolog/bin/2p.jar alice.tuprolog.Agent ~/hello.pro
The output should be as follows.
Hello world
Note: The above is a batch-oriented way to run a Prolog program. This is outlined on page
17 of the PDF manual. Two other ways are described there.
9. IDE
For information on using the IDE, check the PDF manual. More information is available at
TuProlog IDE .
10. End of page
11. Acronyms and/or initialisms for this page
1 acronyms omitted (login required)