go to previous page   go to home page   go to next page


Loops and branches.

Loops and Branches

Diagram of an automaton

A programming language without loops and branches would be nearly useless. The same is true for finite-state automata. The new example automaton has two transitions out of the start state and has a loop between state q1 and itself and a loop between states q0 and q2.

This automaton has two final states. This is OK. An automaton must have only one start state, but can have one or more final states. A string is accepted if its last character is consumed by a transition that leads to any final state.

The example input string is accepted by this automaton. The loop at state q1 accepts any number of character 'b', including zero.


Consume one character, and move to the next state.