Modula-2 || Compiler & Tools || Library || Search Engine

Ulm's Modula-2 System:


prolog - Modula--Prolog interpreter


prolog [-is] [file...]


Prolog is an interactive user interface to the UNIX version of the Modula--Prolog system. The interpreter is compatible to the Prolog language as described in Clocksin & Mellish.

Files to be consulted must end in `.pdb' (prolog database) and are to be given without suffix. The search path may be specified by the environment variable PROLOGPATH (like PATH a list of directories separated by colons). If not found this way the file will be searched for in /usr/local/lib/prolog.

If not overrided by option -s the file startup will be consulted at the beginning. Using PROLOGPATH it is possible to have an individual startup file:

consult('/usr/local/lib/prolog/startup'). /* first action */
/* own startup definitions */

After having read the startup file, prolog consults the given file arguments (without suffix) in that order, and starts (if not suppressed by -i) the interactive mode.

During interactive mode every goal is newline-terminated (a dot is not necessary). An empty line causes the interpreter to enter the meta mode, which allows either to leave the interpreter, to purge the database, or to continue. During goal proving interrupts (BREAK-key or ^C on some terminals) allow to abort current action, or to toggle tracing. Abortion can be time consuming due to space deallocation.

Modula--Prolog allows to implement Prolog clauses in Modula-2. Such a module containing Modula-2 implemented clauses can be linked to the interpreter this way:

MODPATH=/usr/local/lib/prolog; export MODPATH
m2c -o my_prolog clauses.m2 MPImports.m2

The implementation module clauses.m2 (the name can be freely choosen) contains the clauses. MPImports serves as importing link between the interpreter module and the own module. It is imported by the interpreter and should consist of imports only.

Following clauses are implemented in MPUNIX which is imported by the default version of MPImports.m2:

shell(C) when C is instantiated to an atom it is interpreted as an shell command
listlength(L,I) succeeds if L is a list with I elements
listelement(L,I,V) succeeds if the I-th elements of L equals to V.


/usr/local/lib/prolog/startup.pdb default startup file
/usr/local/lib/prolog/lists.pdb further utilities
/usr/local/lib/prolog/libprolog.a Modula--Prolog library


Carlo Muller, Modula--Prolog User Manual
W.F.Clocksin, C.S.Mellish: Programming in Prolog


BBC Brown, Bovery & Company, Limited, Baden / Switzerland, 1985

This manual page is due to Andreas Borchert.

Edited by: borchert, last change: 1997/03/10, revision: 1.1, converted to HTML: 1997/04/28

Modula-2 || Compiler & Tools || Library || Search Engine