







































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Regular Language Representation
Typology: Slides
1 / 79
This page cannot be seen from the preview
Don't miss anything!








































































2
4
C, Java, Python, Prolog, Pascal,...
When is a program:
syntactically correct?
compilable?
free from fatal exceptions at runtime?
free from deadlock or infinite loops?
a correct implementation of its
specification?
Formal Languages Definition ---
Study of “strings of symbols,” including their
descriptions, properties,
generations, recognitions,
compiling, applications, … Strings of symbols include those of
natural languages, computer languages, discrete signals, …
Dr. Gouda
Dr. Gouda
Strings
The empty string will be denoted by e
Examples
abfbz is a string over S 1 = {a, b, c, d, …, z} 9021 is a string over S 2 = {0, 1, …, 9} ab#bc is a string over S 3 = {a, b, …, z, #} ))()(() is a string over S 4 = {(, )}
Languages
Languages can be used to describe problems
with “yes/no” answers, for example:
L 1 = The set of all strings over S 1 that contain the substring “fool” L 2 = The set of all strings over S 2 that are divisible by 7 = {7, 14, 21, …} L 3 = The set of all strings of the form s#s where s is any string over {a, b, …, z} L 4 = The set of all strings over S 4 where every ( can be matched with a subsequent )
EXAMPLE 1 The language defined by the expression aba language (aba) = {aa aba abba abbba abbbba ...}**
EXAMPLE 2 The language of the expression ab language(ab) = {λ a b aa ab bb aaa aab abb bbb aaaa ...} we should be very careful to observe that ab ≠ (ab)***
EXAMPLE 3 Consider the language T defined over the alphabet Σ = {a, b, c} T = {a c ab cb abb cbb abbb cbbb abbbb cbbbb ...} T = language ((a + c)b) = language (either a or c then some b's)*
EXAMPLES 1- Consider a finite language L that contains all the strings of a's and b's of length exactly three. L = {aaa aab aba abb baa bab bba bbb} we may write L = language ((a + b)(a + b)(a + b)) or for short, L = language ((a + b)^3 ) 2- The set of all possible strings of a's and b's of any length whatsoever we could write, (a + b)*
3- We can describe all words that begin with the letter a simply as: a(a + b) 4- All words that begin with an a and end with a b can be defined by the expression a(a + b)b = a (arbitrary string) b**
Definition
For primitive regular expressions:
L( ∅ ) = ∅
L(λ ) = {λ}
L(a) = {a}