Some notes on using SWI-PROLOG

I recommend, but do not require, that you do this on the PC.  (It also works on the Unix system.  But on the PC, you needn't struggle with putty and emacs.)  You can get the interpreter free; do an Internet search for SWI-PROLOG.  I recommend Notepad++ for an editor, as it helps you balance parentheses, but you can use what you want.

On Unix, type prolog to start SWI-PROLOG.


To load a program p4, type ['p4'].

To repeat a command, use up-arrow.

To stop PROLOG, type halt.


To start debugging:  identify a function you want to stop on, for example, solveAux.  Type spy(solveAux).  nospy(solveAux) reverses this.

Commands in the debugger include:

a        abort debugging
space go on (into function, or next line).  Like F11 in Visual C++.
s         skip (execute next line, without going into it).  Like F10 in Visual C++.
l          leap (to next spy point, or end of program).  Like F5 in Visual C++.
u        up (return from current call).  Like F12 in Visual C++.

When not in the debugger, you may see the word [debug] or [trace], meaning, debug or trace next command.  nodebug. or notrace. will stop this.

It's nice to use the graphical debugger. Type gtrace to start it.  (Of course, it won't work in Unix unless you have a GUI like FreeNX or XWin32.)  notrace. stops it.

 

You can use the single-char commands in this window, or click the buttons you see near the top.