Comments for Swarmites
MAML stands for Multi-Agent Modeling Language and it was
initiated for agent-based modeling and simulation. In its current state,
it is heavily based on
Swarm
functionalities, as its current compiler (xmc)
generates Swarm (v1.02 or v1.3) code which can be compiled again using
the appropriate (gcc) compiler.
The main goal of MAML is to provide the functionality of Swarm without
the low-level (mostly C and/or Objective-C) technical burdain. To achieve
it quickly, the current version of MAML defines a macro-language for Swarm.
This macro-level programming introduces higher level concepts of modeling,
and simplifies some constructs already included in Swarm by hiding out
technical details needed to program them. The macro-language nature of
MAML, however, preserves the accessibility of the whole Swarm machinery.
MAML has a special syntax which helped its implementation and also helps
to differentiate between Swarm and MAML statements. This syntax however
might seem a bit awkward in some cases, because is is somewhat verbose.
The syntax was planned this way with future enhancements and MAML functionalities
(another high-level concepts) in mind, and some 'verbose' statements are,
in fact, only placeholders for future tools.
Actually, very few of the planned MAML constructs are included in this
version. Most of the current MAML structures are simplified and clarified
concepts from Swarm itself. For example, the concept of model has
led to the MAML structure called @model
(no submodels are supported in this first version yet). The model structure
can be extended by an @observe structure,
which builds upon the ideas introduced in Swarm. The main difference from
Swarm, however, is that these two MAML structures allow for different MAML-keywords
to be used within them, thus helping to separate the different functionalities.
Also, constructs usable in @observe-s
allow for later extensions of the @model
and the agents. This helps to avoid the conceptually messy current practice
in Swarm, which while separates the model and the observer, forces the
user to incorporate message handlers into the model and the agents - making
the model's entities handle the queries of the observer.
Another important MAML construct provided in this version is the toolset
for the scheduler machinery which is represented by (fairly) short MAML
keywords and statements, and still preserve the whole functionality provided
by Swarm.
To end this impromptu listing of major MAML constructs, some important
'syntactic sugar' must be noted. We have incorporated a mechanism to simplify
the creation phase of agents (and objects), providing support for the creation
of agent arrays too. This @create
construct has proved to be a very powerful machinery.
Finally, as some keywords have been 'duplicated' (i.e., keywords very
similar to those in C and Objective-C), we must quickly clarify their roles.
As with C and Objective-C compilers, the MAML compiler (xmc)
also has two phases: the preprocessor and the compiling phases.
(Contact the reference manual
for more details.) In the preprocessor phase the usual 'preprocessor
directives' are available for MAML, too. These are the $define
and $import constructs. While
the syntax and, to some extent, the functionality of these structures
are different from the usual C/Objective-C equivalents, the main
purpose is the same. Note, however, that these constructs belong
to the MAML compiler (xmc),
and thus define-replacements and file-imports take place before
the MAML-code is compiled, while on the other hand traditional (Objective-C)
#imports and #defines
only make their effects after the MAML-compilation. Therefore,
definitions and imports intended for the MAML compiler should follow
the $import / $define
format.
Also, for the sake of simplicity, a MAML construct, @uses
has been introduced, whose functionality is similar to that of #import
in Objective-C. @uses, however,
is preferable as it is conceptually clearer.