Download presentation
Presentation is loading. Please wait.
Published byCuthbert Myron Collins Modified over 8 years ago
1
Recursive Definitions and Regular Expression RD -- A method of defining sets RE -- A concise way of expressing a pattern in a language
2
Recursive Definitions: 3 Steps Rule 1. Specify basic objects in the set. Rule 2. Give rules for constructing more objects in the set. Rule 3. Declare that no other object in the set. Example: EVEN R1. 2 is in EVEN. R2. If x is in EVEN then so is X+2. R3. Those are the only elements in EVEN.
3
Regular Expression A regular expression is a concise way of expressing a pattern in a series of characters. Regular Language (RL) -- a language that can be defined by regular expression. RL has 4 representations: –RERegular Expression –FAFinite Automata –TGTransition Graph –RG Regular Grammar
4
Formal Definition of RE (Linz page 74) Let be a given alphabet. Then 1. ,, and a are all regular expressions. These are primitive RE’s. 2. If r 1 and r 2 are regular expressions, so are r 1 + r 2, r 1 r 2, r 1 *, and (r 1 ). 3. Those are the only RE’s.
5
Examples of RE X*, XX*, a*b*, (ab)*, X(XX)* (a+b)b*, b*ab*a(a+b)* (a+b)(a+b)(a+b) informal notations: a +, a 3 (a+b)*, (a+b)*a(a+b)*, (a+b)*aaa, a(a+b)*b Note: * always contains. See more examples from Linz book(p75-77).
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.