MAML -- Multi-Agent Modeling Language
000

[ Initiative ][ Introduction ][ Overview ][ Supported Swarm versions ][ Compiler Download Page ][ Compiler Usage Guide ][ Tutorial ][ Course Outline ][ Examples ][ Reference Manual ][ Papers ][ Comments for Swarmites ][ Technical Manual ] ][ About ]

How to use MAML (in the Lab)


This document helps you learn how to use the computers in the Lab in order to develop models in MAML. If you would like to use MAML outside the Lab, see this document.


Computers

Currently the MAML compiler supports only one platform, the PC/LINUX. Versions for other UNIX (e.g. for the O2 and O200) can be produced easily following this document. We haven't tried Mac and PC/WindowsNT. So the best way to start is to sit in front of a PC in the Lab and boot LINUX (this is the default operating system on the PCs). We have X-window installed and automatically started on each LINUX (X-window is the standard graphical user interface on UNIX systems). All the PCs can be used in the same way, your home directory is the same on each of them (we have network file system). After log in you can ask for shell windows from the local computer and from our servers (jancso is a PC/LINUX server, solyom is an SGI-O200/Irix).


Settings

First of all you have to get the current version of the MAML compiler and make it accessible for you. To do that, create the ~/bin directory (if it doesn't exist) by executing the following command in a shell window:

mkdir ~/bin

Then make a symbolic link to the current version (v0.03 (0820)) of the MAML compiler (called xmc):

cd ~/bin ; ln -s ~fakir/xmc0820/xmc xmc ; cd -

Finally add the following lines to your ~/.profile file if you don't have ~/bin in your PATH environment variable:

PATH=$PATH:$HOME/bin/
export PATH

This will let you use the xmc command to invoke the MAML compiler. You can use different text editors to modify the ~/.profile file. After modification don't forget to execute it in each open shell window by:

. ~/.profile

or by logging out and in again.

It is also recommended to create a directory (e.g. ~/maml/) where you develop your MAML programs. The best is to use a different subdirectory under this one for each project/program you write.


Text editing

There is a grapical text editor, called textedit and a non-graphical one, called joe that we suggest you to use. You can simply type textedit & or joe filename in a shell window to launch them. Use the manual pages to get more help on how to use these editors:

man textedit
man joe

Other text editors available: emacs (graphical), pico, vim, jed (non-grapical ones).


Compilation

Compilation has two phases. First the MAML compiler generates Swarm code from the MAML source. In the second phase the Swarm files are compiled and linked together with the gnu C compiler.

To start the first phase invoke xmc with the name of the MAML source file as a parameter:

xmc MyFirstAppl.maml

Without any parameter the compiler prints out a brief help message.

The Swarm code is generated to a subdirectory MAML_target under your current working directory. This subdirectory is overwritten when you reinvoke the MAML compiler. You can specify another name for this subdirectory like this:

xmc MyFirstAppl.maml PutItHere

If you received no error messages, the second phase can come now. The easiest way to do it is to follow the instructions the compiler gives you when terminating:

Code generated in "MAML_target" directory.
Type: sh -c "cd MAML_target; make it; run"

You don't even need to type it, use the left button of your mouse to select text and the middle button to paste it. (If you only have two buttons, pressing both emulates the missing middle one.)

sh -c "cd MAML_target; make it; run"

This command compiles and links the Swarm files, if no error arises then produces an executable named run and even executes it.

The first phase of the compilation can be done on any of the LINUX boxes (e.g. on jancso or on the local). The second phase should be done on a server (jancso or solyom), because only the servers have Swarm installed.

To do the two phases at the same time you should invoke the MAML compiler with the -m option:

xmc -m MyFirstAppl.maml

This option also enables the MAML compiler to locate most of the second phase errors in the MAML source files.

See also this.


Running the program

If the compilation (both the MAML to Swarm and the Swarm to executable part) succeeds, an executable is produced in the target subdirectory (remember, the default name is MAML_target). The name of the executable is run. To run it, change to the target subdirectory and enter run.

As it was written in the Compilation section, you can run the simulation right after the compilation, if you follow the instructions printed by the MAML compiler.

The O200 and a PC have different binary executable format so for example if you compile on jancso you cannot run the executable on solyom, or if you process the second phase of the compilation on solyom, the executable won't run on a PC/LINUX.


Cleaning up

When you finished experimenting with your model, please, remove the unnecessary files, to save disk space (the executable can be rather huge). You only need the MAML source files, because recompiling it when you need it again does not take too much time. So delete the target directory, like:

rm -r MAML_target

copyright © 1999 agent-lab
Send comments to maml@maml.hu