ASTRA Example: Hello World

At their core, ASTRA programs are executed in exactly the same way as AgentSpeak(L) programs. The main differences come in the syntax, and the anciliary supports, such as modules, multiple inheritance, and typing. To help you move from the AgentSpeak(L) syntax, to the ASTRA syntax, this section (and the next three sections) present the ASTRA equivalents of the AgentSpeak(L) example programs given earlier.

The first program was a basic hello world program for AgentSpeak(L).  The ASTRA equivalent is:

01 agent Hello {
02     module Console console;
03
04     initial !init();
05 
06     rule +!init() {
07         console.println("hello world");
08     }
09 }

This program is semantically identical to the AgentSpeak(L) program, but is longer.  The reason for this additional length is that ASTRA is more verbose and also, ASTRA does not hide as much (specifically, you must explicitly declare any modules that provide primitive actions used by the program).

Because the program prints out to the console, we have had to declare that we are using the console module (this provides the functionality to print to and read from the console).

Secondly, we are assuming that the program is to be saved in the root folder (the default package) so we do not need a package statement at the start.