This is an old revision of the document!
DFA and RegExp Exercises
Exercise 1. Write a Regex for IP addresses.
Exercise 2. Concatenation and Kleene operators applied on languages:
2.1. $ A =\{ 0^{2k} \text{ $
$ B = \{0, \epsilon \}$
$ AB = ? $
2.2.
$ A = \{ 0^n 1^n \text{| n \geq 1} \} $
$ B = \{ 1^n \text{ | n \geq 1} \} $
$ AB = ? $
$ BA = ? $
2.3.
$ A = \emptyset $
$ B = \{ 1^n \text{ | n \geq 1} \} $
$ AB = ? $
$ A^* = ? $
$ B^* = ? $
Exercise 3. Writing Regular Expressions
3.1. Write a regular expression for the language of arithmetic expressions containing +, * and numbers.
Hint: you can abbreviate $ 0 \cup 1 \cup \ldots \cup 9 $ by $ [0-9] $
3.2. Write a regular expression for $ L = \{ \omega \text{ in } \text{{0,1}} ^* \text{ | every sequence of consecutive zeros appears before ANY sequence of consecutive ones} \} $
Exercise 4. Write a DFA for $ L(( 10 \cup 0) ^* ( 1 \cup \epsilon )) $
Exercise 5. Write a regular expression which generates the accepted language of A:
Exercise 6. Simplify the regular expression you found.