I am writing a static analyser including a frontend for programs in a specific language.
The front-end succeeds to generate an AST from a program, on which the analyser works well: it either proves the program correct (for some specific properties), or raise an error for a statement or an expression.
In case of error, I would like to make the error message explicit. Thus I want to add the exact localisation
in the source code for the statement or the expression where an error is raised. Showing the line number
will be already good, showing row number
will be even better...
Could anyone tell me how to modify the frontend to do this? Or is there any document I could study?
(I guess first i need to modify the types in AST, but do I have to add loc
to everything?)