Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CZASE3 (5 points - Diagram only - No program required) Create the state diagram described in this exercise in 8.5x11 portrait orientation and put it
CZASE3 (5 points - Diagram only - No program required) Create the state diagram described in this exercise in 8.5"x11" portrait orientation and put it in a PDF file named C2A5E3_StateDiagram.pdf. Using an application such as Word, Visio, etc. to create it is preferred, but a neat hand-drawn diagram is also acceptable. Regardless of how the diagram is created, significant credit will be deducted if I consider it to be sloppy or hard to read. Your state diagram must analyze the contents of an arbitrary string of characters to determine if its syntax is that of a "decimal floating literal" and if so, its type. A formal syntax definition is provided later but a few examples that do and do not conform to that definition are provided below for your consideration. One thing that often surprises students is that any expression starting with a plus or minus sign is never a numeric literal of any kind. YES: NO: 1.2 1.2e0 12e+5 16-1 0.0 +1.2 -1.20 1.2e+ 161 00 Oe0 5E5 .02E08 +0e0 535 e08 6e6f 6e6L 6.F 6.e-25F -6e6f 6e6+L 6F 6.e-2.5F The first part of the required state diagram is provided below and must be present in your finished diagram, with the ??? transitions at the boitom connected to what you add. A state machine is often implemented as a separate function and in this diagram the word ENTER represents the function's entry point. Transitions to the following four identifiers represent returns from the function and have the indicated meanings: FAIL - string did not representa decimal floating literal. FLOAT - string represented a type float decimal floating literal. DOUBLE string represented a type double decimal floating literal. LDOUBLE string represented a type long double decimal floating literal. Additional Requirements: 1. A correct diagram has exactly 9 states. Function entry points and returns do not count as states. 2. State names must meaningfully indicate the current status of the string parse and must be legal identifiers that you will use unaltered in your state machine code in the next exercise. 3. Use identifiers FAIL, FLOAT DOUBLE, and L_DOUBLE as return indicators only - never as state names. 4. The string's next character is available upon entering each state and all transitions out of that state must be based solely upon that character. Looking back or looking ahead is prohibited. 5. More than one default transition out of any state makes no logical sense and is always wrong. 6. Because the state diagram is processing a string and not a file do not label anything as EOF. 7. Do not attempt to determine the numeric value of a floating literal. ENTER FAIL FAIL point START NO WHOLE digit FAIL digit FAIL DOUBLE end point WHOLE FRACT digit digit Ele F/F LA 1 ??? ??? ??? CZASE3 (5 points - Diagram only - No program required) Create the state diagram described in this exercise in 8.5"x11" portrait orientation and put it in a PDF file named C2A5E3_StateDiagram.pdf. Using an application such as Word, Visio, etc. to create it is preferred, but a neat hand-drawn diagram is also acceptable. Regardless of how the diagram is created, significant credit will be deducted if I consider it to be sloppy or hard to read. Your state diagram must analyze the contents of an arbitrary string of characters to determine if its syntax is that of a "decimal floating literal" and if so, its type. A formal syntax definition is provided later but a few examples that do and do not conform to that definition are provided below for your consideration. One thing that often surprises students is that any expression starting with a plus or minus sign is never a numeric literal of any kind. YES: NO: 1.2 1.2e0 12e+5 16-1 0.0 +1.2 -1.20 1.2e+ 161 00 Oe0 5E5 .02E08 +0e0 535 e08 6e6f 6e6L 6.F 6.e-25F -6e6f 6e6+L 6F 6.e-2.5F The first part of the required state diagram is provided below and must be present in your finished diagram, with the ??? transitions at the boitom connected to what you add. A state machine is often implemented as a separate function and in this diagram the word ENTER represents the function's entry point. Transitions to the following four identifiers represent returns from the function and have the indicated meanings: FAIL - string did not representa decimal floating literal. FLOAT - string represented a type float decimal floating literal. DOUBLE string represented a type double decimal floating literal. LDOUBLE string represented a type long double decimal floating literal. Additional Requirements: 1. A correct diagram has exactly 9 states. Function entry points and returns do not count as states. 2. State names must meaningfully indicate the current status of the string parse and must be legal identifiers that you will use unaltered in your state machine code in the next exercise. 3. Use identifiers FAIL, FLOAT DOUBLE, and L_DOUBLE as return indicators only - never as state names. 4. The string's next character is available upon entering each state and all transitions out of that state must be based solely upon that character. Looking back or looking ahead is prohibited. 5. More than one default transition out of any state makes no logical sense and is always wrong. 6. Because the state diagram is processing a string and not a file do not label anything as EOF. 7. Do not attempt to determine the numeric value of a floating literal. ENTER FAIL FAIL point START NO WHOLE digit FAIL digit FAIL DOUBLE end point WHOLE FRACT digit digit Ele F/F LA 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started