Problem 1 [8pt] Write down the set of strings recognized by the following regular expressions. If the set is

infinite, write down the first 7 shortest elements; otherwise, write down all elements.

1. (4pt) (a b)(a b)(a|b)

2. (4pt) a(aa bb)*b

Problem 2 [10pt]

1. (5pt) Write down a regular expression that captures nonempty binaries (strings with 0's and 1's) that

start and end with the same digit and with at least two digits. For example, 010 and 1101 are such

binaries, while 1 and 01 1 are not.

2. (5pt) Write down a regular expression for the language consisting of declarations (in a single line) of

variables of type int in C. Multiple variables can be declared in a single declaration, separated by

commas, and each can have an optional initial value (given by a constant). A declaration is terminated

by a semi-colon. For example, the following two lines are both valid declarations:

int x 3;

int x, y 5, z;

For your convenience, use symbols ID and N for identifiers and integers respectively in your RE.

Moreover, assume there is no space in the definition except for the one after int. Use \s for the

space character.