An early (and limited) version of prolog - cprolog, is available on UHUnix at:
/usr/uh/pkg/cprolog-1.5/
The manual for cprolog is
cprolog (pdf)
Note that C prolog is not a full implementation, and does not have many
of the built-in functions that other interpreters have.
You may NEED to load
frequent.pro
in order to run
some of the example prolog files.
To check, look at the output/transcript files for the prolog programs. They should show which
version of Prolog was loaded and used.
"frequent.pro" contains additional functions that are in other implementations.
Add the following to your .cshrc file to use this version:
alias cprolog /usr/uh/pkg/cprolog-1.5/prolog
NOTE: We will use the file extensions .prlg or .pro, since .pl is commonly used for Perl.
NEW NOTE (May 2010): Since the transition from UHUnix2 to UHUnix, the gprolog on UHunix no longer works.
Documentation and versions for other platforms are available from the free software foundation: http://www.gnu.org/software/gprolog/gprolog.html
Download and install gprolog on your machine.
Learn Prolog Now website . This website uses SWI prolog.
Start the prolog of your choice from the command prompt or icon.
Once Prolog has started, to load a file, use consult to load a file with prolog statements.
consult('file.pro'). or ['file.prlg'].
Don't forget
the period (.) at the end of the statement.
The period tells Prolog you are done entering your statement.
You should get a message that the file successfully loaded.
If there are syntax errors, they will be detected when you load the file.
Once your file is loaded, you can type queries to check your program.
Some tutorials on Prolog are : Learn Prolog Now
To exit from Prolog either input CTRL/D or the halt query:
?- halt.To look at the loaded program/database:
?- listing.To look at a definition in database/program of name:
?- listing(name).To ask for help:
?- help. ?- help(name).To look for help on a topic word:
?- apropos(word).To load a program from a file, give the query:
?- consult('name.pro').
The system to finds, reads, and compiles the file 'name. pl' looking in the standard library and then the working directory.
?- tell('name.pro'), listing, told.
Edit a set of definitions of a term:
?- ed(term).You can add new rules or facts to the program/database:
?- assert( rule ).For example:
?- assert( event(8, mar, 'Prolog lab')).places a new fact in the data base.
Back to the Course homepage
(c) N. E. Reed, 2005-2011