Question: Lexical Elements Exercise Note: You may use the following regular expressions D, Z and L to write your answers D=(0 | 1 1213141 19), Z

Lexical Elements Exercise Note: You may use the following regular expressions D, Z and L to write your answers D=(0 | 1 1213141 19), Z = (1 I 2 13 14 1 19), and L = (A B ICI IZ) Give a regular expression that describes the set of identities consisting of the letters and digits, and that start with a letter, and end with a digit. 1. 2. Give a regular expression that describes the set of identifiers consisting of the letters, the decimal digits, and the underscore characters, and that start with a letter, and with no consecutive underscore. 3. Give a regular expression that describes the multiples of 100. D*(00) 4. Give a regular expression that describes the set of identifiers composed of letters, digits, and the underscore, that begins with a letter or the underscore, and end with a letter. 5. Give a regular expression that describes C-like fixed-decimal constants with no superfluous leading or trailing zeros. (Note that a digit is not required on either side of the decimal point). That is 0.0,.25, 30., 123.01, and 123005.0 are legal, but 00.0, 001.000 and 0002345.100 are illegal. 6. Describe in English the language generated by the regular expression: L+ (DIL| _(DI L)*D. It describes a set of identifiers composed of letters, digits, and the underscore, that begins with a letter and ends with a decimal. Underscore in between always have to be followed by a digit or a letter Provide the FA (finite state automata) for each of the following regular expressions: 1. Identifiers: L(L I D)* 2. Comments: (C language comments) /'*' Not(*')* **"/ 3. Real constants: D+.D+ 4. String constants: "Not(")*" 5. Write the C++ function that corresponds to the FA in question 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
