NFA implementation and tests (taken from examples in http://www.cs.wcupa.edu/~rkline/fcs/nfas.html)