XSB Prolog is the Prolog you should use on CDF. The XSB Home Page contains some useful information, including manuals. Some documentation (maybe even enough is available locally on CDF machines; see /local/doc/xsb.ps. There is nothing special about XSB that should be used for this course (please don't use tabling, and definitely don't use higher-order logic! You'll lose marks for that :-) You can also download XSB for use at home (though I haven't done so). Notes on Using XSB Prolog. (courtesy Suzanne Stevenson) To load (or "consult") a file called file.P: consult('file.P'). consult(file). ['file.P']. [file]. To define some predicates without having to first save them to file, consult "user": [user]. It's a good idea, however, to get in the habit of using files most of the time, because what you type here will be lost as soon as XSB exits, which is likely to happen if you make mistakes typing this file. Many built-in predicates are available in the basics module. To load it: [basics]. To exit XSB: halt. Ctrl-D Debugging in XSB Prolog. ------------------------ For full details on debugging in XSB Prolog, read http://xsb.sourceforge.net/manual1/node103.html which is the page on High-Level Tracing from the XSB online manual. Here are a few specifics: Traces: those let you see every call one by one. Turning trace on: trace. Turning trace off: notrace. Spy point: those let you enter trace mode when a particular predicate is called. Adding a spy point for predicate pred with arity n (i.e., pred takes n arguments): spy(pred/n). Adding a spy point for predicate pred, tracing every instance of the predicate, regardless of arity: spy(pred). Removing a spy point: nospy(pred/n). nospy(pred). Useful commands while in trace mode: : move one step forward l: leap causes the program to resume (i.e., to leave trace mode) until the next spy point, or until the program is done. s: skip the current subprogram: the current subprogram is executed with trace off, and the trace resumes when that subprogram is done. Useful to quickly go through long subprograms that you've already debugged and you don't need to go through the details. Note that the behaviour of these commands may not be intuitively obvious when you work with them, so you should first get accustomed to them with simple programs. These are probably the commands you'll use most often in the debugger. For more commands, read the manual. Dealing with misbehaving code: If your code gets into infinite recursion, you can hit Ctrl-C to stop it. The interpreter will put you in break mode, which you can leave by typing "abort.". Ctrl-D will also take you out of break mode, but it then resumes your program rather than aborting it. Unfortunately, the second time you use Ctrl-C, XSB will exit completely.