Regular expressions Flashcards
what is a regular expression and give an example
An expression describing a language generated using regular operations (union,
concatenation and star)
For example : (0 ∪ 1)◦0∗
What are the different ways to specify languages
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}
Describe the equivalence of regular expressions and automata
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
Define a regular language
One that is accepted by some FA or described by some RE
Give the different applications of regular expressions
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)
Converting a regular expression to an NFA using Thompson’s Algorithm
https://www.youtube.com/watch?v=pUYQejZvYPE
Describe the The Pumping Lemma theorem
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.