Floating Point

State Transition Diagram


This state transition diagram only shows forward transitions. Failure transitions will move to Integer, Sign, DecPt, or S0, if the input character is [0-9], [+ -], [.], or other, respectively.

Based on this State Transition Diagram we can develop the following Right Regular Grammar. Each state is represented by a nonterminal symbol of the grammar. There are four states which are possible terminal states, namely - Integer, Decimal, Mantissa, and Float. The productions that correspond to a transition to one of these four states must include the production which reduces to the terminal symbol that defines the transition.

Sigma -> [0-9]A
-> [0-9]
-> [+-]B
-> [.]C
A -> [0-9]A
-> [0-9]
-> [.]D
-> [.]
-> [eEdD]E
B -> [0-9]A
-> [0-9]
-> [.]C
C -> [0-9]F
-> [0-9]
D -> [0-9]F
-> [0-9]
-> [eEdD]E
E -> [+-]G
-> [0-9]H
-> [0-9]
F -> [0-9]F
-> [0-9]
-> [eEdD]E
G -> [0-9]H
-> [0-9]
H -> [0-9]H
-> [0-9]