Finite State Machines

From Progzoo

You can use a Finite State Machine to recognize some strings and reject others.

Finite State Machine for Decimals

This is a finite state machine that recognizes decimal numbers such as 123 and 0.123 and .789

It will not recognize strings such as 1.2.3 or 1a

A Finite State Machine


[Font] [Default] [Show] [Resize] [History] [Profile]

Finite State Machine for String Literals

A String Literal is a double quote " followed by any sequence of characters (other than a double quote) followed by a double quote.

Acceptable string literals: "one two" and ""

Unacceptable strings one and "one

A Finite State Machine for String Literals


[Font] [Default] [Show] [Resize] [History] [Profile]