You are on page 1of 2

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.

C. $1010# (apply rule 2)-> $10#


$10# (apply rule 2) ->$#

$01010# (apply rule 1)-> $010#


$010# (apply rule 1)-> $0#

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)*

Decimal floating point


digit -> (0|1|2|3|4|5|6|7|8|9)
digit*.digit*( Ɛ| ((e|E)( +| -)digit*))(f|F|l|L)

Hexadecimal floating point


hexDigit -> (0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|A|B|C|D|E|F)
(0x|0X)(hexDigit)*(. | Ɛ)(hexDigit)*( Ɛ | ((p|P)(-|+)hexDigit*))(f|F|l|L)

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*)

You might also like