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

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

View Full Document Right Arrow Icon
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:
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/16/2011 for the course EGN 3210 taught by Professor Fernando during the Spring '05 term at University of Central Florida.

Page1 / 5

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

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online