Also since {a} is regular, {a}* is a regular language which is the set of strings consisting of a's such as , a, aa, aaa, aaaa etc. Note also that *, which is the set of strings consisting of a's and b's, is a regular language because {a, b} is regular. Regular expressions are used to denote regular languages.
2. Topic ContentsTopic Contents
Regular ExpressionsRegular Expressions
Finite Automata and Regular ExpressionsFinite Automata and Regular Expressions
Applications of Regular ExpressionsApplications of Regular Expressions
Algebraic Laws for Regular ExpressionsAlgebraic Laws for Regular Expressions
3. Regular Expressions
Md. Tarek Habib3
Regular expressions are language-defining notation
Regular expressions are useful in applications such as text-search
applications and compiler components
4. Regular Expressions…
Md. Tarek Habib4
A FA (NFA or DFA) is a “blueprint" for constructing
a machine recognizing regular language.
A regular expression is a “user-friendly,"
declarative way of describing a regular language.
Example: 01* + 10*
Regular expressions are used in
1. UNIX grep command
2. UNIX Lex (Lexical analyzer generator)...
9. FA to regex
9
For each accepting state q, apply a reduction process to
produce an equivalent automaton with regular-
expression labels on the arcs. Eliminate all states except
q and the start state q0.
If q ≠ q0, then we shall be left with a two-state
automaton that looks like:
10. FA to regex…
Md. Tarek Habib10
If the start state is also an accepting state, then we must
also perform a state-elimination from the original FA
that gets rid of every state except the start state. Then
we are left with a one-state automaton:
11. FA to regex…
Md. Tarek Habib11
If there is more than one final state in the original FA, then
we must union all the Eq to obtain the final regular
expression.
15. regex to FA
Md. Tarek Habib15
Suppose L = L(R) for a regex R. Then we can design a -NFAε
E such that L(R) = L(E).
E will have:
• Exactly one accepting state
• No arcs into the initial state
• No arcs out of the accepting state