def nfa(self):
        """convert the expression into an NFA"""
        finalstate = State(final=True)
        nextstate = finalstate
        for tokenexpr in reversed(self):
            state = tokenexpr.nfa(nextstate)
            nextstate = state
        return NFA(state)
def nfa ( self ) : finalstate = State ( final = True ) nextstate = finalstate for tokenexpr in reversed ( self ) : state = tokenexpr . nfa ( nextstate ) nextstate = state return NFA ( state )
convert the expression into an NFA