Running Prolog

Using Prolog  

Add

  • /opt/sicstus/bin/sicstus
to your PATH by editing the
  • ~/.bash_profile
file in your home directory (for example, /home/gawron, which is abbreviated ~ when I am logged in).

Before editing your PATH line might look like this:

  • PATH=/usr/local/bin/crypt:$HOME/bin:$HBIN/bin."$CPU":$HBIN:$CWB/bin:$BRILL/Bin_and_Data:$BRILL/Utilities:$CMU_TOOLKIT/bin:$PATH:$HOME/bin:$TGREP:.
Each place to look for programs is set off with a ":".

After editing this:

  • PATH=/usr/local/bin/crypt:/home/sicstus/sp-3.8.6-x86-linux-glibc2.1/bin:$HOME/bin:$HBIN/bin."$CPU":$HBIN:$CWB/bin:$BRILL/Bin_and_Data:$BRILL/Utilities:$CMU_TOOLKIT/bin:$PATH:$HOME/bin:$TGREP:.
You can now run Sicstus Prolog by typing:
  • sicstus
Emacs Interface  

Try inserting the following in a file called .emacs in your home directory:

;;;;;  P R O L O G
; 
; Where prolog is!!!

(setq load-path
   (cons (expand-file-name "/opt/sicstus/lib/sicstus-3.12.5/emacs")
         load-path))
(autoload 'run-prolog "prolog" "Start a Prolog sub-process." t)
(autoload 'prolog-mode "prolog" "Major mode for editing Prolog programs." t)
(setq prolog-use-sicstus-sd t)
;;; Define Prolog file extension for prolog mode
(setq auto-mode-alist (cons '("\\.pl$" . prolog-mode) auto-mode-alist))
;;; Now get one for Perl, because you just took the default away.
(setq auto-mode-alist (cons '("\\.prl$" . perl-mode) auto-mode-alist))

;; Add prolog docs to default info

(setq Info-default-directory-list
   (append Info-default-directory-list '("/opt/sicstus/lib/sicstus-3.12.5/doc/info")))

You can execute the command

    Meta-X run-prolog
The "Meta" key can also sometimes be the "Escape" key. You hold down the Meta key, type "x" and then type "run-prolog".

Prolog will start up under emacs.

Esc-P allows to re-execute the previous Prolog goals. Keep typing Esc-P over and over to see commands further and further back in your command history.

Be sure to see:

    Prolog Manual on the Emacs Interface