Sale!

CECS 524 Assignment 3

$30.00 $18.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (6 votes)

1. (15 points) Write regular expression to capture the hexadecimal floating-point values.
A hexadecimal floating-point value has an optional fractional portion (beginning with a
dot) and a mandatory exponent (beginning with P or p). There may be digits to the
left of the dot, the right of the dot, or both, and the exponent itself is given in decimal
(contains only the digits 0-9), with an optional leading + or – sign. A hexadecimal
floating-point value may end with an optional F or f (indicating “float”-single precision)
or L or l (indicating “long”-double precision).
i. A character
ii. The empty string
iii. Parenthesis
iv. Concatenation
v. ‘or’
vi. Kleene star. (Please use superscript star symbols, ?
)
2. (21 points) Write a Java, C++, and Python programs (without external library) that
determines whether a given stream of characters is a hexadecimal floating-point value
or not.
i. The file names of the source codes should be Assn3.java, Assn3.cpp, Assn3.py.
ii. The programs should read the input file name from the command-line arguments
passed to the program. (args[], argv[], sys.argv[]).
iii. The program should read each line from an input file and print out its evaluation.
iv. You can use any regular expression which is allowed in the programming languages.
v. Execution commands should be:
javac Assn3.java; java Assn3 a3_input.txt
g++ Assn3.cpp -o Assn3; ./Assn3 a3_input.txt
python Assn3.py a3_input.txt
CECS 524 Assignment 3 – Page 2 of 2
vi. Expected output for the provided a3 input.txt.
Matched: 0x1p+1
Not Matched: 0x1p+8.8
Not Matched: 1a.0p-6
Matched: 0x1.b7p-1
Note. Your programs will be tested with a different test file