Use parser error output for translation phase
istathar opened this issue · 1 comments
Good positional error reporting is one of the defining features of megaparsec and we have invested considerable effort in getting decent error messages out of the parser phase. However, if a problem is encountered as we are translating from concrete to abstract syntax trees, we only have a CompilerFailure message - no location or context.
Could we leverage ParseError / ParseErrorBundle and/or SourcePos to get good error messages? If we used the same error rendering code in the translation phase as the parsing phase that would lead to a far more uniform user experience.
At the very least we're going to need to plumb SourcePos (?) throughout Technique.Language's types as we built the concrete syntax tree. Do we wrap it? Add a field to every constructor? The parser will have to do that on the way through, presumably.