Define a regular expression that generates the following language over the alphabet {a, b}:

aaaabaaabaabaaabaabaab...etc...

Define a regular expression that generates the language over the alphabet {a, b} of all strings containing at most two occurrences of a.

For example, the following strings are members of the language:

εabaababbaaaba

The following strings are not members of the language:

aaabaabaabaaaa

Define a regular expression that generates the language over the alphabet {a, b} of all strings containing an odd number of b's.

For example, the following strings are members of the language:

babababbabaa

The following strings are not members of the language:

εabbbababb

Define a regular expression that generates the language over the alphabet {a, b, c} of all strings not containing the substring ba.

For example, the following strings are members of the language:

εaabbbbccbcabbb

The following strings are not members of the language:

bababaabaccaabac

Define a regular expression that generates the language over the alphabet {a, b} of all strings in which the first occurrence of the symbol a (if it occurs in the string at all) is followed by at least one additional a.

For example, the following strings are members of the language:

εbbbaabaabaaaabaa

The following strings are not members of the language:

abbababaa

Construct a deterministic finite automaton that recognizes the language over the alphabet {a, b} containing all strings with an odd number of b's. [See problem 3 for example strings that should be accepted or rejected.]

Construct a deterministic finite automaton that recognizes the language over the alphabet {a, b} containing all strings with an even number of a's and an odd number of b's.

For example, the following strings should be accepted by the automaton:

baabababaabbabaaa

The following strings should be rejected by the automaton:

εabaabbabab

Construct a finite automaton (deterministic or nondeterministic) that recognizes the language over the alphabet {a, b} generated by the regular expression:

(a|ab|abb|abbb)*

For example, the following strings should be accepted by the automaton:

εaaaaababbaabbabbab

The following strings should be rejected by the automaton:

baabbbb

Construct a finite automaton (deterministic or nondeterministic) that recognizes the language over the alphabet {a, b, c} of all strings not containing the substring ba. [See problem 4 for strings that should be accepted and rejected.]

Construct a deterministic finite automaton that recognizes the language over the alphabet {a, b} of all strings where the number of a's in the string is a multiple of 3.

For example, the following strings should be accepted by the automaton:

εbbababaaabaaaababaa

The following strings should be rejected by the automaton:

aababaaabaa

Define a context-free grammar that generates the language of all parentheses-enclosed, comma-separated lists. The alphabet of terminal symbols is

(),a

A list member can be an a symbol or a nested list. A list with 0 members (empty list) is allowed.

Examples of strings in the language:

()(a)(a,a)((a,a),((a),a))(a,a,a,(),a,a,a,a)((((a))),a)

Examples of strings not in the language:

aa,()(a))((a)(aa)

Define a context-free grammar that generates the language
a^{n}b^{n}, the language of *n*
a's followed by *n* b's. Because *n* could be 0,
the empty string is a member of this language.