MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
Finite Automata in compiler design
1. In the theory of computation, a branch of theoretical
computer science, a deterministic finite automaton (DFA)—
also known as a deterministic finite acceptor (DFA) and
a deterministic finite state machine (DFSM)—is a finite-state
machine that accepts and rejects strings of symbols and only
produces a unique computation (or run) of the automaton for
each input string.Deterministic refers to the uniqueness of
the computation. In search of the simplest models to capture
finite-state machines, McCulloch and Pitts were among the
first researchers to introduce a concept similar to finite
automata in 1943.
2. Finite Automata
(a) Nondeterministic finite automata (NFA) have no
restrictions on the labels of their edges. A symbol can
label several edges out of the same state, and E, the
empty string, is a possible label.
(b) Deterministic finite automata (DFA) have, for each
state, and for each symbol of its input alphabet exactly
one edge with that symbol leaving that state.
3. Nondeterministic Finite Automata
1. A finite set of states S.
2. A set of input symbols C, the input alphabet. We
assume that E, which stands for the empty string, is
never a member of C.
3. A transition function that gives, for each state, and for
each symbol in C U (E) a set of next states.
4. A state so from S that is distinguished as the start state
(or initial state).
5. A set of states F, a subset of S, that is distinguished as
the accepting states (or final states).
4. The transition graph for an NFA recognizing the language
of regular expression (aJb)*abb is shown in Fig.
5. Transition Tables
We can also represent an NFA by a transition table,
whose rows correspond to states, and whose columns
correspond to the input symbols and c. The entry for a
given state and input is the value of the transition
function applied to those arguments. If the transition
function has no information about that state-input
pair, we put Q) in the table for the pair
8. DFA
1. There are no moves on input E, and
2. For each state s and input symbol a, there is exactly
one edge out of s labeled a.
If we are using a transition table to represent a DFA,
then each entry is a single state. we may therefore
represent this state without the curly braces that we
use to form sets
9. In Fig. 3.28 we see the transition graph of a DFA accepting
the language (alb)*abb
10. From Regular Expressions to Automata
The regular expression is the notation of choice for
describing lexical analyzers and other pattern-processing
software. How- ever, implementation of that software
requires the simulation of a DFA, or perhaps simulation of
an NFA. Because an NFA often has a choice of move on an
input symbol (as Fig. 3.24 does on input a from state 0) or
on e (as Fig. 3.26 does from state 0), or even a choice of
making a transition on E: or on a real input symbol, its
simulation is less straightforward than for a DFA. Thus
often it is important to convert an NFA to a DFA that
accepts the same language.
11. Conversion of an NFA to a DFA
shows another NFA accepting (a1 b) *abb