Regular Expression
Regular Expression
Presented By :
Sagor Roy
IT-21044
Dept of ICT,MBSTU
Objectives
2
What is Regular Expression
The language accepted by finite automata can be easily described by simple expressions
called Regular Expressions. It is the most effective way to represent any language.
3
Rules of Regular Expression
Union: If R1 and R2 are two regular languages then their union R1 U R2 is also
Regular.
Intersection: If R1 and R2 are two regular languages then their intersection is also a
regular language.
Kleen closure: If R1 is a regular language then its Kleen closure R1* will also be a
regular language.
4
Regular Expression of a Language
1. Write the regular Expression for the following languages over {a,b}
language that accepts all string of length exactly 2
the possible set which accepted by this Finite automata will be {aa,ab,ba,bb}
then the regular expression simply will be the union of this elements
r.e.= aa + ab + ba + bb
= a(a+b) +b(a+b)
=(a+b)(a+b)
Then what is the Regular expression that accepts all string of length atleast 2
Language that accepts all string of length atmost 2
5
Conversion of Finite Automata to Regular Expression
1. For AND we add states and for OR we divide this inputs and for Kleen closure we have
to loop on the state. So the finite automata of ab*a will be :
A a b B a C
6
Conversion of Regular Expression to Finite Automata
7
Conversion of Regular Expression to Finite
Automata(cont..)
1. Q = e + aS + bR
2. R= aQ
3. S=bQ
4. T= aR+bS+aT+bT
Which is the Regular Expression of the given
Putting 2 and 3 in eqn 1 then Deterministic Finite Automata .
Q= e+a(bQ) + b(aQ) And The Regular Expression is
Q=e + Q(ab+ba)* r.e.= (ab+ba)*
By Arden’s Theorem
Q=e(ab+ba)*
Q=(ab+ba)*
8
Q&A
9
THANK YOU
10