Professional Documents
Culture Documents
RE and Finite State Automaton (FA) : UMBC CMSC 331 Notes (9/17/2004)
RE and Finite State Automaton (FA) : UMBC CMSC 331 Notes (9/17/2004)
CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 1 CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 2
CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 3 CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 6
UMBC CMSC 331 notes (9/17/2004)
CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 7 CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 8
Start 0 1
Start
1
CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 9 CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 10
UMBC CMSC 331 notes (9/17/2004)
CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 11 CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 12
a
FA for (a|b)*abb
a
CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 13 CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 14
UMBC CMSC 331 notes (9/17/2004)
every cell q0 q1 q0
q1 q1 q2
q2 q1 q3
INPUT
(a|b)*abb STATES a b
q3 q1 q0
a b b
Q1 q2
q1 q2
q0 q3 Q2 q3 • Recall the NFA:
b
*Q3
CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 15 CMSC 331, Some material © 1998 by Addison Wesley Longman, Inc. 16
DFA to program
• NFA is more concise, but not as easy to RE
implement;
• In DFA, since transition tables don’t
have any alternative options, DFAs are Thompson construction