To load a program from Emacs into Prolog, start up the Emacs/Prolog
interface by typing prolog + at the main operating system prompt.
When the Emacs/Prolog screen appears, type ^x ^f (for
find-file
) followed by the name of the file that contains your
program. (Alternatively, you can type prolog + followed by the
name of the file that contains your program.) After you enter the
Emacs/Prolog environment, activate the window containing your file.
At this point, you have three options: you can load
Being able to load a designated portion of your program is very convenient if you are running a program and discover that you need to make a few changes to improve the program. You can make your changes and then reload just the changed portions, without reloading the entire program. If you are just beginning a Prolog session, however, you will probably want to load the entire buffer containing your program using <ESC> k b.
When you type <ESC> k, Emacs displays the following prompt line at the bottom of the screen:
compile prolog ... enter p for procedure, r for region or b for buffer
In response, you can type b to load the entire buffer: or you can type r to load a region, or p to load a procedure, as described below.
After you indicate how much of your program to load, the
cursor moves to the Prolog window, and
Prolog displays a message that tells you it is loading the program.
As it proceeds, Prolog displays messages to let you know which
procedures are being loaded. For example, if your
program consisted of procedures for parts_of/2
, assembly/2
, and
inventory/2
, Prolog would display the messages:
% compiling procedure parts_of/2 in module user % compiling procedure assembly/2 in module user % compiling procedure inventory/2 in module user
After Prolog has finished loading, it displays a message such as:
% compilation completed, 0.083 sec 448 bytes | ?-
At this point, you can begin to run your program (see bas-run).
Please notes: