You are on page 1of 5
2.8.1 Regular Sets 2.8.2 A regular set is a set of Strings fo t which there i accepting that set. That is, if Ris €Xists some finite automata i a regular set, then R = L(M) for some finite automata M. Similarly, if Mis a finite automata, then L(M) is always a regular set Regular Expression A regular expression is a Notation to specify a regular set. Hence, for every regular expression, there exists a finite automata that accepts the language specified by the regular expression. Similarly, for every finite automata M, there exists a regular expression notation specifying L(M). Regular expressions and the regular sets they specify are shown in the following table Finite automata enor! isa regular expression, where N, is a finite auto; NN, isa finite automata mata ACcepEi i accepting, "BR, a, R,.R, (Where R, and R, are regular sets corresponding to 7, ivel i i and r,, respectively) where N, isa finite automata a N, is finite automata accepting Ry BR, ang R* (where Risa regu- lar set corresponding tor) T-expression operators: | or + to env? The precedence of the eae Operations, and * for closure operatio perators in the decreasing order is: *, followed bY ‘ample, consider the following regular expression: 4 (a+b bh ct a finite follows: th, basic 1 automat - For ex, . I ed ta for this regular expression, we proce’ oe for a and a “xPressions involved are a and 6, and we stat - initially constry, e ne for 6. Since brackets are evaluated fi q 4, as sh momata for g +6 using the automata for 4 Figure 2.25. a 43 FIGURE 2.25 Transition diagram for (a+ b). since closure is required next, we construct the automata for (a + 6)*, using the automata for a + 6, as shown in Figure 2.26. rm for (a+b) ition diag’ 26 Trans +H FIGURE 2- auc ytomat i construct 1 gure 2 step is concatenat “nd a, as snown The next D b - using the automata for (4 compiler Design FIGURE 2.27 Transition diagram fora. (a+b)*, Next we construct the automata for a.(a + b)*.b, as shown in Figure 2.28, Finally, Ficy RE 2.28 Automata fora(a+b)*.b. We con, Struct the Automata for 4.(a + 5)* bb (Figure 2.29)- _— -_ a a FIGURE 2.29 Automata for a.(a+ b)*.b.b. This is an NFA with €-moves, but an algorithm exists to transform the NFA to a DFA. So, we can obtain a DFA from this NFA.

You might also like