Regular Expressions: Theory of Computation CST-352
Regular Expressions: Theory of Computation CST-352
CST-352
Regular Expressions
1
Regular Expressions vs. Finite Automata
• Offers a declarative way to express the pattern of any
string we want to accept
– E.g., 01*+ 10*
Regular
expressions
= Finite Automata
(DFA, NFA, -NFA)
Syntactical
expressions Automata/machines
Regular
Languages
Formal language
classes
• Note that R+ε may or may not equal R (we are adding ε to the language)
• Note that RØ will only equal R if R itself is the empty set.
Example: 1 0 0,1
q0 0 q1 1 q2
1* 00* 1 (0+1)*
1*00*1(0+1)*
University Institute of Engineering 17
RE to -NFA construction
Reg Ex -NFA
Theorem 2
Example: (0+1)*01(0+1)*
(0+1)* 01 (0+1)*
0
0
0 1
1
1
Arden’s Theorem
Note: If there are more than one final states in the given FA then the Regular
expression of the FA will be union of all the expressions evaluated for different final
states.
University Institute of Engineering
References :