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)
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)* = ? a(a+b)*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.

## This note was uploaded on 03/12/2012 for the course IT 101 taught by Professor Fadi during the Spring '12 term at University of Damascus.

### Page1 / 18

RegularExpression - Regular Expressions A new method to...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online