advertisement

Deterministic Finite-State Machine (or Deterministic Finite Automaton) A DFA is a 5-tuple, (S, Σ, T, s, A), consisting of: S: a finite set of states Σ: a finite set of symbols called the alphabet T: a transition function (T : S × Σ → S) s: a start state (s S) A: a set of accept states (A S) Let M be a DFA such that M = (S, Σ, T, s, A), and X = x0x1 ... xn be a string over the alphabet Σ. M accepts the string X if a sequence of states, r0,r1, ..., rn, exists in S with the following conditions: 1. r0 = s 2. ri+1 = T(ri, xi), for i = 0, ..., n-1 3. rn A. Every Regular Expression can be Recognized by some DFA • Regular expressions consist of constants and operators that denote sets of strings and operations over these sets, respectively. • Given a finite alphabet Σ the following constants are defined: – (empty set) ∅ – (empty string) ε – (literal character) a in Σ • The following operations are defined: – concatenation – alternation: a|b – Replication: R* – Wildcard: . (exactly one occurrence) Classical Limitation of DFA no DFA can recognize is bracket language, that is language that consists of properly paired brackets, such as (()()). More formally the language consisting of strings of the form anbn — some finite number of a's, followed by an equal number of b's. It can be shown that no DFA can have enough states to recognize such a language.