In C++ programming language, all the following expressions represent valid numerical “literals”: 3 13. .328 41.16 +45.80 +0 -01 -14.4 1e12 +1.4e6 -2.e+7 01E-06 -.4E-7 00e0 +0e1 .2E-03 Literals consist of an integral part and an optional exponent part. Integral part consists of an optional sign (‘+’ or ‘-‘ ) and literal value. Literal value should consist of at least one digit either before or after the decimal point. However, the decimal point is also optional. Exponent part (which is optional) starts with either ‘e’ or ‘E’, and if it appears, the number following it (‘e’ or ‘E’) must be an integer (with optional ‘+’ or ‘-‘sign). Assume that there are no limits on the number of consecutive digits in any part of literal (but the length of string is limited to 50 digits/characters.) Construct a DFA for language of valid numeric literals. Based on the DFA in (1),
a. Write a C++ program that read in a file of strings, one on each line, and output whether or not each string is a valid numeric literal.
b. Write a regular expression representing the language of numeric literal by using the R (i, j, k) approach as discussed in class. Show your steps.
Compare the efficiency and difficulty writing a program of this DFA approaches with respect to the one in project A. Your program should execute on the machines in the department’s lab. Please test your program thoroughly and make sure it is free of errors. Points will be deducted for each error that I discover for you.
Please also pay attention to program design and follow all the good programming practice. I reserve the right to deduct points based on these criteria.
Submit: DFA diagram for part (1). Intermediate steps of solving the recurrence relation R (i, j, k)