Regular expressions Flashcards

1
Q

what is a regular expression and give an example

A

An expression describing a language generated using regular operations (union,
concatenation and star)

For example : (0 ∪ 1)◦0∗

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the different ways to specify languages

A

i) If the language is finite you can just list its strings eg L = {a, aa, aba, aca}
ii) Descriptive eg L = {x | x ends with 0 or 1}
iii) Using regular expressions L= {aa, ab}* ∪ {b}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe the equivalence of regular expressions and automata

A

RE and FA are equivalent in their descriptive power.
A regular expression can be converted into an FA that recognizes the language it describes and vice versa

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define a regular language

A

One that is accepted by some FA or described by some RE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give the different applications of regular expressions

A

Regular expressions have an important role in computer science applications.
– Specify piece of programming language, e.g. real number. This allows automated production
of tokenizer for identifying the pieces.
– Complex search and replace - awk and grep (on LINUX /UNIX systems)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Converting a regular expression to an NFA using Thompson’s Algorithm

A

https://www.youtube.com/watch?v=pUYQejZvYPE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe the The Pumping Lemma theorem

A

If A is a regular language, then there is a number p where if s is any string in A of length at least p, then s may be divided into three pieces, s = xyz, satisfying the following conditions:

for each i ≥ 0, xyiz ∈ A.
|y| > 0, and
|xy| ≤ p.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly