parses regular expressions and converts it to a nondeterministic finite automaton