Divide the following C++ program into appropriate lexemes: Describe the language denoted by the following regular expressions and provide transition diagrams:

  1. Divide the following C++ program into appropriate lexemes:

float limitedSquare(x) float x; {

/* returns x-squared, but never more than 100*/

return (x <= -10.0 || x >= 10) ? 100 : x*x;

}

  1. Describe the language denoted by the following regular expressions and provide transition diagrams:

    1. a(a | b)*a

    2. ((ε | a)b*)*

    3. (a | b)*a(a | b)(a | b)

    4. a*ba*ba*ba*

  2. Write regular definitions for the following language:

    1. All strings of lowercase letters that contain the five vowels in order.

    2. All strings of lowercase letters in which the letters are in ascending lexicographic order.

  3. Give DFA’s accepting the following languages over the alphabet {0, 1}

  1. The set of all strings ending in 00.

  2. The set of all strings with three consecutive 0’s (not necessarily at the end).

  3. The set of strings with 011 as a substring.

  4. The set of strings that either begin or end (or both) with 01.

  5. The set of strings that the number of 0’s is divisible by five, and the number of 1’s is divisible by 3.

  1. Design finite automata (deterministic or non-deterministic) for each of the language in exercise number (3).

  2. Give the transition table for:

DETAILED ASSIGNMENT

20200930045030assignment_02

Powered by WordPress