Finite-State Automata (FSA)

advertisement
CIS 324: Language Design and Implementation
Language Recognition
1. Finite-State Automata (FSA)
Finite-state automata are capable of recognizing regular languages:
given an input string they determine whether it belongs to the
language predefined by a regular expression.
The FSA can be nondeterministic (NFA)- when more than one transition
out of a state is possible on the same input symbol, or deterministic (DFA).
An NFA can be converted into a DFA by a special algorithm.
2. Nondeterministic Finite Automata (NFA)
A nondeterministic finite-state automaton is a model consisting of:
1) a set of states S
2) a set of input symbols  (the input symbol alphabet)
3) a transition function move that maps input symbol pairs
to sets of states
4) a state s0 that is distinguished as the start (or initial) state
5) a set of states F distinguished as accepting (or final) states
An NFA accepts the input string if and only if there is a path in the
corresponding transition graph from the start state to some accepting
state such that the edge labels along this path spell out the input.
When describing an NFA we use the corresponding transition diagram.
Example: The NFA for the language: ( a | b )*abb is given by the
following transition diagram
b
start
0
a
a
1
b
2
b
3
3. Deterministic Finite Automata (DFA)
A deterministic finite-state automaton is a model consisting of:
1) a set of states S
2) a set of input symbols  (the input symbol alphabet)
3) a transition function move that maps input symbol pairs to sets of states
4) a state s0 that is distinguished as the start (or initial) state
5) a set of states F distinguished as accepting (or final) states
6) NO state has -transition, i.e. a transition on input 
7) for each state s and input symbol a there is
at most one edge labeled a leaving s
Example: The DFA for the language: ( a | b )*abb is given by the
following transition diagram
b
b
start
0
a
1
a
b
a
2
a
b
3
Download