{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Program8_1 - 8.1 Ex Parsing using a Finite State...

This preview shows pages 1–2. Sign up to view the full content.

8.1 Ex – Parsing using a Finite State Machine (FSM) algorithm A finite state machine also known as a finite state acceptor is a theoretical machine or algorithm that uses a table to determine its current state and its action. The system is described with states. Then depending on the current state and on the input you go to a new state and perform some action. The operation of parsing is to convert a string into its meaningful data. For example to convert a string into a real number. In this example we are going to convert a string into a real number or double. We decompose the problem into 4 states: State 0: Represents the starting and ending state. It says we have not yet started and are still expecting the first meaningful data in the number. State 1: In this state we have seen the sign of the value, if for example one put a “-“ or “+” sign in front of the number. State 2: In this state the algorithm is seeing the digits to the left of the decimal. It must multiply the sum by 10 and add the value of the new digit. State 3:

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

Program8_1 - 8.1 Ex Parsing using a Finite State...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online