try to implement regular expression using NFA.
an accepted NFA solution for regular expression matching.