Preview

13 Regular Expressions

Satisfactory Essays
Open Document
Open Document
840 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
13 Regular Expressions
Regular Expressions

This ppt is the work by Dr. Costas Busch, used with permission, and available from http://csc.lsu.edu/~busch/courses/theorycomp/fall2008/ 1

Regular Expressions
Regular expressions describe regular languages

Example:

(a  b c) * describes the language

 a, bc *   , a, bc, aa, abc, bca,...
2

Recursive Definition
Primitive regular expressions:  ,  , 
Given regular expressionsr1

r2 and r1  r2 r1 r2 r1 *

Are regular expressions

 r1 
3

Examples
A regular expression:

 a  b c  * (c   )

Not a regular expression:

 a  b 

4

Languages of Regular Expressions

L r 

r
: language of regular expression

Example

L (a  b c) *   , a, bc, aa, abc, bca,...

5

Definition
For primitive regular expressions:
L   
L     
L a   a

6

Definition (continued)
For regular expressionsr1

andr2

L r1  r2  L r1   L r2 
L r1 r2  L r1  L r2 
L r1 *  L r1   *
L  r1   L r1 
7

Example
Regular expression: a  b  a *

L  a  b  a * L  a  b   L a *
L a  b  L a *
 L a   L b    L a   *
  a   b    a  *
 a, b   , a, aa, aaa,...

 a, aa, aaa,..., b, ba, baa,...
8

Example
Regular expression

r  a  b  *  a  bb 

L r   a, bb, aa, abb, ba, bbb,...

9

Example
Regular expression

r  aa  *  bb  * b

2n 2m

L r  {a b

b : n, m 0}

10

Example
Regular expression

r (0  1) * 00 (0  1) *

L(r ) = { all strings containing substring 00

11

Example
Regular expression r

(1  01) * (0   )

L(r ) = { all strings without substring 00 }

12

Equivalent Regular Expressions
Definition:
Regular expressions r1

andr2

are equivalent ifL( r1 ) L( r2 )

13

Example

L

= { all strings without substring 00 }

r1 (1  01) * (0   ) r2 (1* 011*) * (0   )  1* (0   )
L(r1 ) L(r2 ) L

r1

and r2 are equivalent regular expressions
14

Regular Expressions and Regular Languages

15

Theorem
Languages
Generated by

You May Also Find These Documents Helpful

  • Powerful Essays

    Comp3652 Unit 2 Assignment

    • 1090 Words
    • 5 Pages

    For this assignment, you will be completing the implementation of an interpreter for fractal, a…

    • 1090 Words
    • 5 Pages
    Powerful Essays
  • Better Essays

    Nt1310 Unit 1 Assignment

    • 1994 Words
    • 8 Pages

    5. Convert 32 decimal to binary floating point. Use a 6 bit mantissa and a 4 bit exponent.…

    • 1994 Words
    • 8 Pages
    Better Essays
  • Good Essays

    Ftc Vs Wild Oats Essay

    • 850 Words
    • 4 Pages

    t h e c a s e s b ehind t he h e a d l i nes…

    • 850 Words
    • 4 Pages
    Good Essays
  • Powerful Essays

    w w w. j. b rad fo rd-de l o n g . n e t/…

    • 4970 Words
    • 20 Pages
    Powerful Essays
  • Good Essays

    1.|Although several students in the classroom are talking loudly, Jim's attention is focused only on what his girlfriend is saying. In this instance, the girlfriend's voice is a: |…

    • 4109 Words
    • 17 Pages
    Good Essays
  • Satisfactory Essays

    Flvs Spanish Work

    • 281 Words
    • 2 Pages

    Se llama = is called (this is the verb in the question)|When writing your responses, remember to use the vocabulary from the question to guide you. Start with the subject of the sentence, then the verb (be sure to make changes if the subject changes), then include the other details of the response. |What is the name of the library?|La biblioteca se llama Countryside Public Library. |…

    • 281 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    needs to be taken care of. The extraordinary lifestyle that L.B.J. claims to have is never shown in the movie. L.B.J. is incapable of preforming simple tasks. Stella, the insurance company nurse, constantly tends to L.B.J.’s needs. Stella cooks for L.B.J. and tends to L.B.J.’s medical needs. Stella also attempts keep L.B.J. out of trouble. She tells L.B.J. that staring into his neighbor’s personal lives is an inappropriate behavior. L.B.J. is tended to and kept out of trouble, like a small child.…

    • 586 Words
    • 3 Pages
    Good Essays
  • Better Essays

    La Llorona Research Paper

    • 713 Words
    • 3 Pages

    Today the story is well known by most of the Hispanic community (Hayes, 2009). I hope this essay helped explain La Llorona’s life before having kids, what she did to her kids and what she does today as a ghost. The stories are passed on from generation to generation. She will not be able to rest until she finds her lost children. The spirit of La Llorona still haunts the waters and lakes, wailing for her children.…

    • 713 Words
    • 3 Pages
    Better Essays
  • Better Essays

    Gloria Anzaldua, the author of “How to Tame a Wild Tongue,” expresses a very strong tie that she has to her native language. Anzaldua grew up in the United States, but spoke mostly Spanish. She did not speak the normal form of Spanish though; she spoke Chicano Spanish, a language very close to her heart. The text focuses on the idea of her losing her home accent, or tongue, to conform to the environment she is growing up in. From a very young age, Anzaldua knows that she is not treated the same as everyone else is treated. She knows that she is second to others, and her language is far from second to others as well. Anzaldua stays true to her language by identifying herself with her language and keeping it alive, when everyone else wants it gone. She strategically expresses herself in the text through her personal experiences with the language, the use of narration and structure, and her gender role within her language. Anzaldua uses appeals such as ethos, pathos, and logos to show the audience the use of these three strategies.…

    • 1502 Words
    • 7 Pages
    Better Essays
  • Good Essays

    She drowned her kids out of her own selfishness and she stills searches for them today. The legend of La Llorona is still told today by many people but it originated in southeast Mexico around the eighteen hundreds. The history, purpose, impact, and modern telling all come together to prove the one theme that helps mothers and children across the world. Even though La Llorona wanted all the attention to herself which lead her to drowning her children , she teaches mothers to not have their emotions get in the way of what’s more important and teaches children to respect their mothers by having her story told to them when they are young.…

    • 1674 Words
    • 7 Pages
    Good Essays
  • Good Essays

    Languages define a culture itself and every language in the world expresses the heart and spirit of people who speak it. Languages explain the human capacity for acquiring and using complex systems of communication. Everyone has a language that they convey and pursue in everyday activities. Gloria Anzaldua, author of “How to Tame a Wild Tongue”, is a Mexican American woman who takes great pride in her culture, but struggles to keep the form of Spanish called, “Chicano Spanish” alive. Born and raised in South Texas, Anzaldua will always have Mexican culture in her blood, but living in such a strict American society, she feels pressured to choose to speak either an English that American society would appreciate, or Castilian that the Mexican society would agree with. Growing up, Anzaldua slowly realized that others mistreated her because her language was poor. She expresses herself in the text through her personal experiences, struggles, and her gender role within her language and culture.…

    • 930 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Language Analysis 1

    • 806 Words
    • 3 Pages

    Initially, readers notice the eye catching image of a young female teenager with multiple piercings on her…

    • 806 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    C h i l d a b u s e : P a r e n t a l m e n t a l i l l n e s s , l e a r n i n g d i s a b i l i t y,…

    • 102565 Words
    • 411 Pages
    Powerful Essays
  • Good Essays

    Aztec Legends

    • 513 Words
    • 3 Pages

    The famous “La llorona” she was an indigenous woman who had loves with a Spanish conqueror, fruit of which it had three children were born. But the man prefirió to marry a Spanish lady and the aborigen maddened hung his children, threw them to a river and then she itself killed itself. The legend counts that from entonce the soul in a sorrow of the woman crosses the channels and rivers shouting: “¡Ay mis hijos!, ¡ay mis hijos!("sigh my children ... sigh my children!").…

    • 513 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    AQR Case

    • 3166 Words
    • 13 Pages

    w a s A Q R ’s p r i m a r y o b j e c t i v e , i n s t a l l i n g A Q R C a p i t a l M a n a g e m e n t , L L C a s t h e F u n d ’s I n v e s t m e n t…

    • 3166 Words
    • 13 Pages
    Powerful Essays