how to build simple FSM using generators ?

Joh joh12005 at yahoo.fr
Wed Sep 8 16:25:34 EDT 2004


hello,

i've readed "Charming Python: Generator-based state machines"
www-106.ibm.com/developerworks/ linux/library/l-pygen.html , but i
still can not get the point on how using generator for FSM

i'm interested in a very simple FSM which would be able to recognize
consecutive sequence of texts, please can someone give me a hint on
how to do this using yield ?

by now, my fsm is something like, having a "previous state", iterating
in a while 1 loop, advancing "previous state" to recognized word and
if len(recognized all words) is matched then a sequence had been
recognized, whatever else re-init FSM ;
but can not understand how could yield help me...

thx.



More information about the Python-list mailing list