My next compiler series post will cover error reporting in the parser. For good error reporting in the parser we need to at least report the line and column number of the error. This implies more communication between the parser and the lexer. In particular we have to tell Happy to use a threaded lexer. This implies the usage of monads. I’ve gotten up to this point in Haskell with no real understanding of monads.
I have to split off my compiler series and read about and more importantly understand what monads are and what they do.
My first step is to read the chapter 14 of Real World Haskell on monads. I promise I’ll be back after my excursion. It might be a while since I’m not too bright and it takes me a while to grok abstractions. I’ll do my best and report back.