RegularExpression - Regular Expressions A new method to...

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

View Full Document Right Arrow Icon
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, …}
Image of page 1

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

View Full Document Right Arrow Icon
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)* )
Image of page 2
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
Image of page 3

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

View Full Document Right Arrow Icon
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)
Image of page 4
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)* = ?
Image of page 5

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

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern