Algorithm for converting a finite state machine into a regular expression | Hacker News Reader