Toy implementation of Thompson NFA regex