Comment
Comment by kubb
This is one way to do it, but there is another way, which has some advantages, namely using the parsec combinator library. The latter allows you to write a lexerless parser and avoid any code generators. It's the more interesting one for sure.