Knickknack does not do much right now ... but who doesn't have an item or two of little value ...
I started playing with the idea of a state machine a few weeks ago and at this point I have a functional one. Not surprisingly, The states of the machine are modelled as c++ object instances with the type of state defined by the class of the object.
I am a big fan of interpreted languages (like python) for this kind of stuff but I do not imagine you could get a lot done with a python interpreter loaded on an Arduino. I did want the flexibility of being able to define states easily and potentially dynamically. To that end the state machine loads itself from an XML definition (I used TinyXML to parse this definition).
Loading state from XML is kind-of interesting ... while testing the basic state machine I was loading the states dynamically from the serial monitor ... it raises interesting possibilities for re-programming the device remotely.
There is definitely an overhead cost to parsing the XML and maintaining a hierarchy of state objects ... it works well but this whole idea may need to be optimized or totally re-evaluated for memory consumption if the device gets very sophisticated.
So far I have a few states (for testing):