*
*   Example of a state machine as described in
*      State Machine Description Language (Comsat Labs)
*      (forgive me if I get it wrong, I'm doing this
*       from memory, and it's been about 8 years)
*
statemachine sm1

    declare
         states    state0, state1, state2;
         events    event1, event2, event3;
         initialstate   state0;

    begin
         in state0 when event1 if condition1 do action1 enter state2;
         in state0 when event1 do action2 enter state1;
* second rule would apply if condition1() returns FALSE
         in state1 when event2 do action3;
         in state1 when event2 do action3 enter samestate;
* above two rules are identical
         in state1 when anyevent do report_error;
* in state1, any event except event2 (see above) calls report_error;

    end.