05 June

State Machines

Dave Roberts reflects upon the importance of state machines in computing and laments that programmers must reinvent them when needed for lack of language support. He's using Lisp macros to implement a state machine mini-language.

At least one language does have built in support for state machines. New in J 5.03 is a state machine primitive. From the J Dictionary:

x;:y implements a sequential machine (finite state machine, finite state automaton). x is the specification of a machine, including the state transition table, and y is the input. A sequential machine solves the problem of recognizing the "words" in the input. The machine starts in some initial state and processes the input one item at a time; given the current state and input item, the new state and output are determined by the state transition table. The machine then proceeds to process the next input item.

Though not a primitive, Lush includes a state machine library for manipulating grammars and graphs.

Posted by Steve at 18:15 | Comments (0) | Trackbacks (0)
There is no comment.
There is no trackback.
Post a comment