SWI-Prolog (open source, good Prolog system) is installed in Johnson 118. SWI Prolog can be used as a stand-alone IDE, although I find the interface a bit awkward and thus my personal preference is to use it from within XEmacs. A suitable ``Prolog mode'' for such an interaction is also installed on the machines in J118.
Programs may be composed and edited using any text editor, such as notepad on Windows. In any case, make sure that you have a good text editor. A programmer's editor is a very different thing from a word processor. Most importantly, it saves your work in plain text files and it doesn't insert extra carriage returns beyond the ones you actually type (so, Microsoft Word does not qualify). A good programmer's text editor will do a lot more than this, including:
There are many text editors that have some or all of these features. The most widely used editors on UNIX systems are vi and Emacs (or a variant called XEmacs). They are also subjects of a long standing holy war. Various ``modes,'' supporting various programming languages, exist for both of them.
You are of course free to program in any editor you like (including ed). You are of course free to program in any editor you like (including ed). For this course though, I recommend XEmacs. In addition to everything mentioned above, XEmacs is also able to run programs as ``inferior processes'' (their term), allowing you to communicate with them from within the editor. The Prolog mode we will use takes advantage of this feature and offers an seamless integration with Prolog interpreters and compilers.
The disadvantage (there is no such thing as a free lunch, you know) is
that XEmacs interface is quite different from anything you have
probably seen. While most commands you are likely to use are
accessible from menus or the toolbar, keyboard shortcuts do come
handy, and XEmacs' are quite different from a usual Windows
environment. Here is a list of the most used commands and their
shortcuts (in Emacs-speak,
C stands for Control, and
stands for Meta; the Meta key is usually bound to Alt, but Esc can be
used as well:
M-x stands thus for pressing (and holding)
Meta/Alt and then pressing x, or pressing (and releasing) Esc
and then pressing x):
|XEmacs function call||
Under the standard configuration of the lab machines, once a file with
the right extension (
.pl for Prolog programs) is opened, XEmacs
will automatically switch to the appropriate mode (called
prolog-mode; if for some reason the right mode does not fire up
automatically, you can switch to it by hand by calling its name as an
Once you are in the right mode, explore the mode menus ( ``Prolog,'' ``Code,'' ``Help'') for useful commands.
Fire up your favourite editor and write your Prolog program. Save it
somewhere. Let's say for the sake of discussion that you save it as
Then fire up SWI Prolog, change to the directory holding your program,
and issue the loading command. In Prolog, the ``change directory''
cd, and the ``load'' command is
your interaction looks like this:
?- cd("~/prolog"). Yes ?- consult(foo). % foo compiled 0.00 sec, 1,960 bytes Yes
Note that, outside XEmacs, SWI Prolog features a graphical interface (under XEmacs we rely completely on the XEmacs GUI).
The departmental lab in J118 runs Linux, which is one of the many flavours of Unix. The major difference between Linux and Windows is that one way of interaction with the system happens through a command line interface (CLI), much like the DOS prompt but much more powerful. You have however the usual window system (a bunch of them actually) at your service.
Here are some tutorials that offer a quick introduction to Unix.