FSM Plugin3 Input Syntax

From FSL
Jump to: navigation, search

The MOP FSM plugin syntax instantiates the generic <Logic Name>, <Logic Syntax>, and <Logic State> from the Logic Repository Syntax. It is used in conjunction with the <Logic Repository I/O> syntax, and defined using BNF

// BNF below is extended with {p} for zero or more and [p] for zero or one repetitions of p
 
// The mandatory MOP logic syntax
<FSM Name> ::= "fsm"
<FSM Syntax> ::= { <Item> } { <Alias> }
<FSM State> ::= <Group Name> | <State Name> | "fail"
 
// The auxiliary elements for the logic syntax
<Item> ::= <State Name> "[" { <Transition> [","]}"]"
<Transition> ::= <Event Name> "->" <State Name>
| "default" <State Name>
<Alias> ::= "alias" <Group Name> "=" { <State Name> "," } <State Name>
<State Name> ::= <Id>
<Group Name> ::= <Id>

<FSM Name>

<FSM Name> instantiates <Logic Name> from the MOP Syntax. It denotes the FSM logic using the string "fsm".

<FSM Syntax>

<FSM Syntax> instantiates <Logic Syntax> from the MOP Syntax. It has two parts; state descriptions with transitions(<Item>) and groupings of states(<Alias>).

<FSM State>

<FSM State> instantiates <Logic State> from the MOP Syntax. In a FSM specification, <FSM State> can be any state or alias to a group of states (<Alias>) in the state machine. Alternatively, it can be fail, a special state, which the state machine transitions to whenever a transition is invalid and no default transition is specified. Note that fail is a preserved state name in the FSM specification and cannot be re-defined in any <Group Name> or <State Name>. The state machine is unable to leave the fail state once it is entered.

<Item>

<Item> defines a state with its transitions (<Transition>). Note that the first listed state is assumed to be the start state.

<Transition>

Each transition states, for a given state and input, the state to transition to. One can also specify a default transition with the keyword default. The default transition is taken whenever the current event is not accepted by any of the normal transitions in the current state. If no default transition is specified, the finite state machine instead goes to the fail state. Multiple transitions may be separated by commas.

<Alias>

<Alias> allows one to associate an alias with a group of states (See the example below). A <Group Name> can be used in a handler to signify that any state associated with the group triggers that handler.

<State Name>

An identifier to represent a state.

<Group Name>

An identifier to represent a set of states.

Example

<mop>
<Client>Web</Client>
<Events>hasnext next dummy</Events>
<Property>
<Logic>fsm</Logic>
<Formula>
start [
default start
next -> unsafe
hasnext -> safe
]
safe [
next -> start
hasnext -> safe
]
unsafe [
next -> unsafe
hasnext -> safe
]
alias all_states = start, safe, unsafe
alias safe_states = start, safe
</Formula>
</Property>
<Categories>fail safe unsafe all_states safe_states</Categories>
</mop>

In this example, three events, namely, next, hasnext and dummy, and three states, namely, start, safe and unsafe, are defined. Two state aliases are declared: all_states represents all the states in the state machine and safe_states includes the start state and the safe state. Note that the state machine will go into "fail" whenever a dummy event is received, unless the machine is in the start state, in which case it will stay in the start state.

When using an FSM in an MOP specification, one may associate handlers for certain states or state aliases (see MOP Syntax), which will be executed when the state machine reaches the designated states. For the above example the unsafe state can trigger a <Property Handler> (see MOP Syntax) denoted as @unsafe. The safe state can trigger a handler denoted as @safe. If the dummy event occurs in any state an @fail handler would be triggered. If a handler is associated to a state alias, e.g., all_states or safe_states, it will be triggered when the state machine reaches any state included by the alias. For example, a handler labeled with @all_states would be triggered by any state in the state machine, and @safe_states will be triggered by the start and safe states.

Personal tools
Namespaces

Variants
Actions
Navigation