Formal Language Theory
Formal Language Theory
1. Definition
Alphabet is a, usually finite, set of characters or digits.Alphabet is the set
{ a, b, c, ..., x, y, z, A, B, C, ..., X, Y, Z, 0, 1, 2, ..., 7, 8, 9, _ }.
String is defined as a finite sequence of members of an underlying ... set
of all variable identifiers in the programming language C.
Language is defined as code or syntax which is used to write programs
or any specific applications. Language is used to communicate
with computers. Broadly language can be classified into three categories
assembly language, machine language, and high-level language.
2. difference
DFA refers to Deterministic Finite Automaton. DFA can be best described
and understood as one machine.
NFA refers to Nondeterministic Finite Automaton. NFA is like multiple
small machines that are performing computational activities at the same
time.
3. Answer
b b a
a a
b
(b) all strings with at least one a
b b
a
a
1
ADMAS UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE
(d) all strings with at least one a and exactly two b’s
a a a
b b
a
b
a a a
a b b
b
a
b
b
a b
(e) all the strings with exactly two a’s and more than two b’s
b a a
a b
b
b
b b a
b a b
a
a
b
a
a b
2
ADMAS UNIVERSITY
DEPARTMENT OF COMPUTER SCIENCE
5. Write regular expressions for the following languages on {0, 1}.
a) all strings ending in 01,
(0+1)*01
b) all strings not ending in 01,
λ + 0 + 1 + (0 + 1)*(00 + 10 + 11)
c) all strings containing an even number of 0’s,
(1 * 01 * 01)*
d) all strings having at least two occurrences of the substring 00.
(0 + 1)*(00(0 + 1)*00 + 000) (0 + 1)*
e) all strings with at most two occurrences of the substring 00,
(1 + 01)*(001+(01+)*00 + 000 + 00 + 0 + λ) (1 + 10)*
f) all strings not containing the substring 101.
0*1*0* + (1+ 00 + 000)* + (0+1+0+ )*