Source: https://cs.anu.edu.au/courses/comp2600/Lectures/03NFA.pdf