This is an old revision of the document!


Code layer structure

The code layer is used to describe the behaviour of individual agents in Alvis models. The layer uses Alvis behaviour description statements and some elements of the Haskell functional programming language.

The code layer must contain at least one agent block as shown in Listing 1. It is possible to share one definition among a few agents. In such a case, a few agents' names are placed after the keyword agent separated by commas.

agent AgentName 
{
  -- declaration of parameters
  -- agent body
} 

Listing 1. Structure of an agent block

Both Haskell and Alvis are case sensitive languages. Haskell requires type names to start with an upper-case letter, and variable names to start with a lower-case letter. We follow Haskell footsteps. Moreover, Alvis requires agent names to start with an upper-case letter, and port names to start with a lower-case letter.

Go back