Language & Regular Expressions Flashcards
Alphabet
A finite set of fundamental units, Σ
Language
A set of strings of symbols from the alphabet, plus rules specific to the language
Words
Finite strings that are permissible in the language generated from the alphabet and the rules of the language
empty, null string symbol
lowercase epsilon ε or uppercase lambda Λ
Concatenation
Joining character strings end-to-end
Palindromes
A word, phrase, number or sequence of words that reads the same backwards as forwards
Closure Kleene Star
A programming resource that offers outcomes related to the concatenation
Regular expressions
A sequence of characters that define a search pattern
Rule 1 of defining regular expressions
If x ∈ Σ then x is a regular expression
Rule 2 of defining regular expressions
If r1 and r2 are regular expressions then so are (r1), r1r2, r1|r2, r1*
Rule 3 of defining regular expressions
Nothing else is a regular expression
When can only 2 regular expressions be equivalent?
If and only if they describe the same language
Rule 1 for language to be associated with a regex
If r is a regex, then language(r) = {r}
Rule 2 for language to be associated with a regex
If L1 = language(r1) and L2 = language(r2), the (r1r2) = L1L2, (r1|r2) = L1|L2, (r1) = L1