Instructions for using XGP on the Tome Macs
- Run XGP from Applications | XGP | XGP
- Using your favorite text editor (such as Aquamacs), open or
create a text file.
- Do not use XGP's built-in editor -- for technical reasons, this
editor is unable to save your files.
- By convention, the name of the text file should end in the
.pl extension. In the remainder of these instructions, we will
assume that your file is called source.pl, and that you have put
some Prolog statements in the file.
- XGP insists that your file uses UNIX-style line endings. If
you created your file on a Tome Mac, it will have the right kind
of line endings. If you downloaded it from somewhere else, and
the file was originally created on a Windows machine, then it
probably doesn't have the right kind of line endings. To fix
this in Aquamacs, type Alt-x
set-buffer-file-coding-system[Enter]utf-8-unix[Enter]. Then
save the file. Interested in this crazy problem? Read about it
in the Wikipedia
Newline page.
- In XGP:
- consult the file by choosing "Tools | Load or Consult file..."
- check for any errors in the XGP Console window. If necessary, fix any errors, save the file, then choose "Tools | Load or Consult file..." again.
- choose "Tools | Evaluate Query..."
- In the XGP "Evaluate Query..." window:
- Type a query.
- Depending on what kind of response you want, click Once, First, Next, or All
- Now make some kind of change to source.pl in your text editor,
and save the file.
- Note that XGP will not automatically notice that the file
has been updated. The "Consult Changes Before Evaluating" feature does not work. The only way to evaluate
queries on the new file is to choose "Tools | Load or Consult file...", and
select your file (e.g. source.pl) again.
- Note that the Halt button in the "Evaluate Query..." window does not work. To
halt a long-running query, select "Tools | Halt Running Thread".
Instructions for using tracing facilities with XGP:
- These instructions use the
file course-inference.pl as an
example. We assume you would like to trace the query
teachingStudent(maccormick,gao).
- Consult the file course-inference.pl, then evaluate the query
"trace, teachingStudent(maccormick,gao)."
- In the XGP Console window, repeatedly press the Enter key to
step through the evaluation.
- To terminate tracing, enter "n" (followed by Enter) in the XGP Console window.