Agents

An agent is a process template: local attributes plus process equations over transitions.

SPL
agent Name(param1 : Type1, param2 : Type2) {
    attributes {
        attr1 : Type = initialValue ;
    }
    process {
        Eq1 = <behavior expression> ;
        Eq2 = <behavior expression> ;
    }
    invariants {            // optional
        Eq1 : <expression> ;
    }
}

Parts#

The behavior operators (., +, ||, guards, branch, atomic, …) are described in Process Calculus.

Example#

SPL
type PhilState = { THINKING, HUNGRY, EATING } ;

agent Philosopher(id : Int) {
    attributes {
        state : PhilState = THINKING ;
    }
    process {
        Think    = getHungry(id) . TryForks ;
        TryForks = pickLeft(id) . pickRight(id) . Eat
                 + pickRight(id) . pickLeft(id) . Eat ;
        Eat      = startEating(id) . Release ;
        Release  = putLeftFork(id) . putRightFork(id) .
                   finishEating(id) . Think ;
    }
    invariants {
        Eat : state == HUNGRY || state == EATING ;
    }
}

Philosopher loops through Think, TryForks, Eat and Release. The + in TryForks is the nondeterministic choice of which fork is picked up first.

↑ ↓ to moveEnter to openEsc to close