Acronym for Finite State Machine.
Finite state machine, finite state automata, or state machine, is used in computer science or logic theory to represent a finite number of states and the transitions between states.
Finite state machines are commonly used in parsing and matching strings, so it accepts certain types of strings (such as those representing an integer), and a language (set of strings) is regular if and only if it can be represented as a finite state machine.
An example of a finite state machine implementation in pseudocode, accepting all decimal integers:
state = 0;
digits = "152341264"; // Some sequence of decimal digits
for (k = 0; k < len(digits); k++) {
switch (state) {
case 0: // Initial state
if (digits[k] is a decimal digit)
state = 1;
else
state = 2;
break;
case 1: // Digit found, also an accepting state
if (digits[k] is a decimal digit)
state = 1;
else
state = 2;
break;
case 2: // Dead state
break;
}
}
FSM accepts the string digits if it finishes at state 1.
Finite state machines represent all the regular languages, or Type 3 languages, which are the lowest in the Chomsky hierarchy, below the context-free (Type 2) languages, which is below the context-sensitive (Type 1) languages, which is below the recursively enumerable (Type 0) languages.
The tag is also known like finite-state-machine on stackoverflow.