ANML Documentation

Simple Automata Using STE

This section provides examples of simple automata built with STEs.

Basic STE

A basic STE for a state labeled "a" with a transition function on the input of either a or A:

<state-transition-element id="a" symbol-set="[aA]">
</state-transition-element>
Figure 1. Basic STE (AP Workbench)
Simple automation

This STE receives no input and is not connected to other STEs, and therefore, generates no output.

Simple Automaton with Input and Output

A simple automaton network with input and output for a state labeled "a":

<state-transition-element id="a" symbol-set="[a-z]" start="all-input">
    <report-on-match/>
</state-transition-element>
Figure 2. Simple Input/Output Automaton (AP Workbench)
Ste a2io

This automaton accepts symbols from the input stream and reports when an input symbol matches the symbol set.

The infinity symbol ∞ indicator (all-input attribute) shows the STE is active for all symbol cycles.

An all-input STE remains active and receives and tests every input symbol against the symbol set. An important difference between ANML and classic finite state automata is that any ANML STE may be designated as an all-input or start-of-data STE. In the formal definition of finite automata, only a single state may be designated as the start state.

The R indicator (report-on-match attribute) shows the STE reports when an input symbol matches the symbol set.

A Larger Automaton

The automaton below contains three states. It accepts symbols on STE 1 and, on a match, activates STE 2.

If STE 2 matches a b, STE 3 will be activated. If, on the next input cycle STE 3 sees an a, the match will be reported because reporting is enabled for this STE.

<state-transition-element id="1" symbol-set="a" start="all-input">
    <activate-on-match element="2"/>
</state-transition-element>

<state-transition-element id="2" symbol-set="b">
    <activate-on-match element="3"/>
</state-transition-element>

<state-transition-element id="3" symbol-set="a">
    <report-on-match/>
</state-transition-element>
Figure 3. Larger Automaton (AP Workbench)
Ste largerautomata simple

STE 1 is configured to receive all-input so it will be continuously activated. If this automaton were to be presented with the sequence aba, on the final a, the report output signal would be generated by STE 3 and the final a would also be evaluated and matched by STE 1, causing STE 2 to be activated for the next input cycle. If the sequence continued with ba, a second output report would be generated by STE 3.

Self-Activating Automaton

The following automaton is identical to the previous example except for an additional activate-on-match signal in STE 2 that activates itself. After STE 2 is activated by STE 1, it will continue to remain activated as long as the input symbol is a b. Without the self-activation loop, the previous automaton would only generate an output signal in STE 3 after seeing the sequence aba. This automaton will report output on /ab+a/ where + means one or more (that is, a followed by one or more b followed by a).

<state-transition-element id="1" symbol-set="a" start="all-input">
    <activate-on-match element="2"/>
</state-transition-element>

<state-transition-element id="2" symbol-set="b">
    <activate-on-match element="2"/>
    <activate-on-match element="3"/>
</state-transition-element>

<state-transition-element id="3" symbol-set="a">
    <report-on-match/>
</state-transition-element>
Figure 4. Self-Activating Automaton (AP Workbench)
Ste selfactivating

Input Sequence with Different Symbol Sets

The following example shows an automaton that uses the three methods for expressing symbol sets (single character, regex character class, numerical class).

The automaton recognizes an input sequence beginning with an uppercase A followed by one of the following lowercase letters: a, e, i, o, u, followed by a symbol with a value between 0 and 9.

<state-transition-element id="q0" symbol-set="A" start="all-input">
    <activate-on-match automaton="q1"/>
</state-transition-element>

<state-transition-element id="q1" symbol-set="[aeiou]">
    <activate-on-match automaton="q2"/>
</state-transition-element>

<state-transition-element id="q2" symbol-set="{0:9}">
    <report-on-match/>
</state-transition-element>
Figure 5. Programming a Symbol Set (AP Workbench)
Ste patterns