Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BNFC#176] Haskell: Store node position in the AST
When using bnfc to generate haskell code with the --functor option, the parser will no store the begining position of the corresponding code in each node. This might be useful, for instance, to report errors. Note that this is possibly a larger change than it had to be because I tried something new: instead of generating code by putting together strings (or the slightly fancier PrettyPrint.Doc), I refactored the code that makes happy production to generate an AST which is then pretty-printed. Both the AST types and the pretty printer being of course generated by BNFC itself! This seems like an obvious thing to do but for some reason we never did. The main advantage is that it makes much better use of the type checker (whene everything is a string, it doesn't mean much that the type checking passes...). In addition, you get much cleaner code by getting rid of all the separators, keywords, symbols and parentheses that are now inserted by the pretty printer.
- Loading branch information