Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (29.69 KB, 1 trang )
COMPILER CONSTRUCTION
Week 2 Tutorial Questions
Regular Expressions, NFA and DFA
1. Let ∑ = {a,b}. Write regular expressions for the languages over ∑ that contain:
a. All strings.
b. The empty string.
c. The string abb.
d. The strings ba and aba.
e. All strings beginning with ab.
f. All strings beginning with a a and ending with a b.
g. All strings that contain exactly two a’s.
h. All strings in which every a is followed by a b.
2. Construct nondeterministic finite automata (NFA) from the following regular
expressions:
a. (a|b)(a|b)
b. a(a|b)+
c. (ab|b)*a
d. abb(a|b)?a
Note: You may use Thompson’s construction algorithm.
3. Construct deterministic finite automata (DFA) from the NFA’s constructed in
question 2.
4. Minimise the following DFA:
a
B
a
a
a
A