Professional Documents
Culture Documents
Homework 1
Homework 1
1. A. Rule 1 : 01 -> Ɛ
Rule 2: 10 -> Ɛ
B. No. Given the example $010#. Using the rewrite system above, we can
either use rule 1 where $010# -> $0# or rule 2 where $010#->$0#. Using,
either rules will produce the same results.
2. Octal integer
0(0|1|2|3|4|5|6|7)*
Hexadecimal integer
(0x|0X)(0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|A|B|C|D|E|F)*
Integer
(Ɛ |-)(0|1|2|3|4|5|6|7|8|9)+(U|u| Ɛ)(L|l|LL| Ɛ)
3. A. ((Ɛ | 1) 0*)*
All strings over the alphabet {0, 1} including Ɛ.
B. (0|1)*0(0|1)(0|1)
All binary strings of length more than equals to 3 that end with 000, 001, 010
or 011.
C. (00|11)* ((01|10)(00|11)*(01|10)(00|11)*)*
All binary strings of even length wherby if there are an even number of “01”
and “10”, there are an even number of 0s and 1s.
4. A. a*(a+b*|a+c*)*
B. (c*(a| Ɛ)c*(b| Ɛ)c*(b| Ɛ)c*(b| Ɛ)c*)|
(c*(b| Ɛ)c*(a| Ɛ)c*(b| Ɛ)c*(b| Ɛ)c*)|
(c*(b| Ɛ)c*(b| Ɛ)c*(a| Ɛ)c*(b| Ɛ)c*)|
(c*(b| Ɛ)c*(b| Ɛ)c*(b| Ɛ)c*(a| Ɛ)c*)