1. A programmable finite state machine configured to transition to one of a plurality of next states from a current state in response to receipt of an input symbol, each of the current state and next states being represented by m bits and each input symbol being represented by k bits, the programmable finite state machine comprising: a first memory configured to store a plurality of transition rules, said first memory further configured to receive a (k+m)-bit word representative of the input symbol and the current state and to supply one or more matching transition rules in response, wherein the one ore more matching transition rules are stored in a ranking order of generality; a logic block configured to select a most specific transition rule from among the one or more matching transition rules; and a second memory configured to receive the selected transition rule and to supply one of the plurality of next states in response.