skip to navigation
skip to content

ssfsm 0.6.0

ssfsm is a constructive library implementing deterministic finite state machines. The fun thing is, that it has a stupidly simple API.

ssfsm is a constructive library implementing deterministic finite state machines. The fun thing is, that it has a stupidly simple API. Example:

# A FSM that accepts b*a(ab)*
import ssfsm
A = ssfsm.Machine()
A.One['a'] = A.Two
A.One['b'] = A.One
A.Two['ab'] = A.Two # a and b transition
A.Two = True # Set state Two to accepting
A().reset(A.One)

And transitions are done this way:

A('a') # a-Transition
A('ab') # a-Transition followed by b-Transition
bool(A) # is A in an accepting state

Some helpers to make construction even easier so the first example can be written as:

import ssfsm
A = ssfsm.Machine('One')
A().alphabet = 'ab'
A.One['b'] = A.One
A().polyfill(A.Two)
A.Two = True
 
File Type Py Version Uploaded on Size
ssfsm-0.6.0.tar.gz (md5) Source 2015-05-05 3KB