Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dept. of Computer Science & IT, FUUAST Theory of Computation 2 Regular Expressions Regular Expression.

Similar presentations


Presentation on theme: "Dept. of Computer Science & IT, FUUAST Theory of Computation 2 Regular Expressions Regular Expression."— Presentation transcript:

1

2 Dept. of Computer Science & IT, FUUAST Theory of Computation 2 Regular Expressions Regular Expression

3 Dept. of Computer Science & IT, FUUAST Theory of Computation 3 Regular Expressions

4 Dept. of Computer Science & IT, FUUAST Theory of Computation 4 Precedence of Regular Expression Operators Regular Expressions

5 Dept. of Computer Science & IT, FUUAST Theory of Computation 5 Regular Expressions

6 Dept. of Computer Science & IT, FUUAST Theory of Computation 6 Write Regular expression for the following languages Represent the following sets by regular expression a){a,bc} b){1,11,111,1111,………..} c){ab, a, b, bb} d){b 2, b 5, b 8, ………….} e){a 2n+1 | n≥0} d) L 1 ={a 2n b 2m+1 | n≥0, m ≥0 } Regular Expressions

7 Dept. of Computer Science & IT, FUUAST Theory of Computation 7 Regular Expressions Identities:

8 Dept. of Computer Science & IT, FUUAST Theory of Computation 8 Regular Expressions

9 Dept. of Computer Science & IT, FUUAST Theory of Computation 9 Regular Expressions

10 Dept. of Computer Science & IT, FUUAST Theory of Computation 10 Regular Expressions

11 Dept. of Computer Science & IT, FUUAST Theory of Computation 11 Regular Expressions

12 Dept. of Computer Science & IT, FUUAST Theory of Computation 12 Regular Expressions Converting Regular Expressions to Automata R + S L(R) ⋃L(S) RS L(R)L(S)

13 Dept. of Computer Science & IT, FUUAST Theory of Computation 13 Regular Expressions R * L(R * ) Regular Expression to an є-NFA

14 Dept. of Computer Science & IT, FUUAST Theory of Computation 14 Regular Expressions Regular Expression to an є-NFA a) b)

15 Dept. of Computer Science & IT, FUUAST Theory of Computation 15 Regular Expressions c)

16 Dept. of Computer Science & IT, FUUAST Theory of Computation 16 Regular Expressions Closure properties of Regular Languages:

17 Dept. of Computer Science & IT, FUUAST Theory of Computation 17 Regular Expressions

18 Dept. of Computer Science & IT, FUUAST Theory of Computation 18 Regular Expressions

19 Dept. of Computer Science & IT, FUUAST Theory of Computation 19 Regular Expressions

20 Context-Free Languages Dept. of Computer Science & IT, FUUAST Theory of Computation 20 ( CFL )

21 Dept. of Computer Science & IT, FUUAST Theory of Computation 21 Context-Free Languages ( CFG )

22 Dept. of Computer Science & IT, FUUAST Theory of Computation 22 Context-Free Languages

23 Dept. of Computer Science & IT, FUUAST Theory of Computation 23 Context-Free Languages

24 Dept. of Computer Science & IT, FUUAST Theory of Computation 24 Context-Free Languages

25 Dept. of Computer Science & IT, FUUAST Theory of Computation 25 Context-Free Languages Rules:Productions: Derivation Symbols

26 Dept. of Computer Science & IT, FUUAST Theory of Computation 26 Context-Free Languages

27 Dept. of Computer Science & IT, FUUAST Theory of Computation 27 Context-Free Languages Derivation Symbols

28 Dept. of Computer Science & IT, FUUAST Theory of Computation 28 Context-Free Languages Language Of a Grammar

29 Dept. of Computer Science & IT, FUUAST Theory of Computation 29 Context-Free Languages

30 Dept. of Computer Science & IT, FUUAST Theory of Computation 30 Context-Free Languages

31 Dept. of Computer Science & IT, FUUAST Theory of Computation 31 Context-Free Languages Parse Trees

32 Dept. of Computer Science & IT, FUUAST Theory of Computation 32 Context-Free Languages Ambiguous Grammars

33 Dept. of Computer Science & IT, FUUAST Theory of Computation 33 Context-Free Languages Ambiguous Grammars

34 Dept. of Computer Science & IT, FUUAST Theory of Computation 34 Context-Free Languages

35 Dept. of Computer Science & IT, FUUAST Theory of Computation 35 Context-Free Languages Useless Productions G = (V,T,S,P) is Context-free Grammar with P, S → aSb | λ | A A → aA A is useful if there is at least one w L(G) such that S xAy w a)Empty Productions A → λ, A λ b)Unit Productions A → B, A B c)Left Recursion A → Ax

36 Dept. of Computer Science & IT, FUUAST Theory of Computation 36 Context-Free Languages

37 Dept. of Computer Science & IT, FUUAST Theory of Computation 37 Context-Free Languages

38 Dept. of Computer Science & IT, FUUAST Theory of Computation 38 Context-Free Languages Normal Forms 1)Chomsky Normal Forms 2)Greibach Normal Forms Chomsky Normal Forms (CNF) Any context-free language without any λ- production and unit production is generated by a grammar in which productions are of the form

39 Dept. of Computer Science & IT, FUUAST Theory of Computation 39 Context-Free Languages 2) 3)

40 END Dept. of Computer Science & IT, FUUAST Theory of Computation 40


Download ppt "Dept. of Computer Science & IT, FUUAST Theory of Computation 2 Regular Expressions Regular Expression."

Similar presentations


Ads by Google