Starting the interpreter
The syntax/options of the interpreter are as follows: studio [*gt | *ot | *nt] [ < module-name > ].
- The options (*gt, *ot or *nt) specify the threading model.
If you don't specify the threading model then the default option (*nt) will be used.
It is always a good choice.
- module-name specify, which module you wish to start.
This module should contain a starting query.
If there is not starting query then nothing will happen.
- You don't have to specify the module-name.
The default behaviour is to load the minimal set of pre-defined symbols and clauses and start the interactive session.
Threading models
- Native Threads (default)
Threads are started and managed using the underlying OS.
Time measurements are obtained from OS as well.
- Green Threads
Threads are managed using interpreter's pool of threads.
The thread switch happens inside wait and other synchronisation instructions.
Time is also measured inside the interpreter.
- Opaque Threads
Threads are started and managed using the underlying OS.
However, time measurements are obtained from the interpreter.
... briefly about HERCs Prolog modules
- A module is usually stored in a text file with a dot-prc extension (.prc).
- (few system-modules are included inside the interpreter, so don't try to find studio.prc file, it is part of the interpreter)
- A module contains symbols. Symbols usually have definitions attached to them. These definitions are called clauses.
- Clauses can be called (or executed).
- A module can have a starting query, which is a sequence of calls.
This is the main starting point of the program, just like the main function in C/C++ or in Java.
The starting query is located at the end of the script, after the end := and just before the final dot (.).
- The interactive session between the user and the Prolog interpreter is defined in Prolog itself.
To start the interactive session, simply call [command].
It will then keep reading your commands from the keyboard until you write [exit], which will end the session.
- Therefore you will frequently see the following sequence of initial calls: end := [[set_colors 0xffff00 0] [command]] ..
The first command changes colours to please the eyes.
The second command starts the interactive session.
After the interactive session ends, nothing more happens here (there are no more instructions after).
- Have a look at sample modules.