RegularExpression

# RegularExpression - Regular Expressions A new method to...

This preview shows pages 1–6. Sign up to view the full content.

1 Regular Expressions A new method to define languages alphabet language S = {x} S* = {Λ, x, xx, xxx, …} or directly {x}* = {Λ, x, xx, xxx, …} language language S = {xx, xxx} S* = {Λ, xx, xxx, xxxx, …} or directly {xx, xxx}* = {Λ, xx, xxx, xxxx, …} “letter” language x* (written in bold) language( x* ) = {Λ, x, xx, xxx, …} or informally x* = {Λ, x, xx, xxx, …}

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 Regular Expressions L1 = {a, ab, abb, abbb, } or simply ( ab* ) L2 = {Λ, ab, abab, ababab, } or simply ( ab ) * Several ways to express the same language {x, xx, xxx, xxxx, } xx* x + xx*x* x*xx* (x + )x* x*(x + ) x*x*xx* L3= {Λ, a, b, aa, ab, bb, aaa, aab, abb, bbb, aaaa, } or simply ( a*b* ) (a s before b s) Remark: language( a*b* ) language( (ab)* )
3 Regular Expressions Example: S-ODD Rule 1: x S-ODD Rule 2: If w is in S-ODD then xxw is in S-ODD S-ODD = language( x(xx)* ) S-ODD = language( (xx)*x ) But not: S-ODD = language( x*xx* ) xx|x|x

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 Regular Expressions A useful symbol to simplify the writing: x + y choose either x or y Example: S = {a, b, c} T = {a, c, ab, cb, abb, cbb, abbb, cbbb, } T = language( (a+c)b* ) (defines the language whose words are constructed from either a or c followed by some b s)
5 Regular Expressions L = {aaa, aab, aba, abb, baa, bab, bba, bbb} all words of exactly three letters from the alphabet {a, b} L = (a+b)(a+b)(a+b) (a+b)* all words formed from alphabet {a,b} a(a+b)* = ?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern