This chapter explains how to use the BAP compiler to translate PROLOG programs into executable code modules.
Provided the BAP compiler is already installed, please start the system. A shell will open and a prompt will appear:
< ?- _
Please type in:
> load_compilerPlease remember that the '>' and the '<' characters indicate input and output and are neither displayed by the system nor have to be typed in by the user.
The compiler is now loaded onto the transputer network. Several windows will appear on the screen and you should get a message looking like this:
< installed the compiler pipeline on (1/23) (2/5) (3/5) < ; < ?- _
In case that no such message appears, please make sure that the 'compiler' directory is contained in your PATH and retry again.
The system is now ready to compile PROLOG programs. Of course, the first example will be the Hello World program. This is provided in your 'example' directory. Please change the current directory to this directory, using cd() (e.g. cd('../example').
The prompt will return immediately. Additionally, you should recognise some activity in the windows that appeared earlier. Depending on your host server, you also may see an editor popping up. Please take a look at the window which is now titled 'Compile - hellow'. Its output will look like this:
< ASSEM: parsing ####... < ASSEM: assembling < ASSEM: optimizing < ASSEM: writing output file < doneAs soon as the last line ('done') appears, the translation of the example program is completed. A file called 'hellow.lkd' has been written to your working directory.
You might have encountered some errors in case you forgot something in the installation process. The following messages are common:
< ERROR: Couldn't open source file <hellow.bap>.- you probably did not change to the 'EXAMPLE' directory properly
< ERROR: Couldn't find include file <prolib.h>- you probably did not set the BINC variable correctly
After each error message you have to answer with an <ESC> or <RETURN> hit in the error window.
Please fix the problem and try it again!
If everything went right up to this point, you now may 'load' the new file by entering:
You should again see a semicolon and a new prompt:
< ; < ?- _If the semicolon does NOT appear something went wrong because the system did not find the executable file. Please check that you didn't encounter a spelling mistake.
To start the example program, enter:
The reply on your screen should look like:
< Hello World! < ; < ?- _
You have just compiled and executed your first program with the BAP compiler. We hope that you will enjoy using the system and that many more programs will follow!
You will find some more example programs explained in the 'Language Tutorial'.