Professional Documents
Culture Documents
Objectives: o Symbol Used in Regular Expression o Rules To Build Regular Expression o Examples Regular Languages
Objectives: o Symbol Used in Regular Expression o Rules To Build Regular Expression o Examples Regular Languages
Objectives: o Symbol Used in Regular Expression o Rules To Build Regular Expression o Examples Regular Languages
-1-
Lecture 7
Objectives
Regular Languages
Regular Expression
o Symbol Used in Regular Expression
o Rules to Build regular Expression
o Examples
Regular Languages
All those languages are regular for which we can write regular expression
Letter of alphabet
Parenthesis ( )
o To concatenate multiple regular expressions
Star Operator *
o * operator is used to 0 to n times repetition.
Plus Operator +
o + operator is used to provide option to select from two choices.
Tahir Naseem/Handout 7
-2-
There can be only two words ( a and b) of 1 length over given alphabet set then can be
generated occurrence of a or b.
Example2:
Language having words {aa, bb} over = { a b}
aa can be generated occurrence of a twice and can be generated by using rule 1 and
2b.
Similarly for bb
Example3:
Language
{, a, aa, aaa, aaaa }
over = { a b}
Tahir Naseem/Handout 7
-3-
R.E = a*
Example4:
Language
{, b, bb, bbb, bbbb }
over = { a b}
Example5:
Language
{b, ab, aab, aaab, aaaab, aaaaab, }
over = { a b}
Example6:
Language
{b, ab, aab, aaab, aaaab, aaaaab, }
over = { a b}
Tahir Naseem/Handout 7
-4-