Has there been work on deriving code formatters from parsers, esp. parser combinators?
E.g. of taking a parser that generates an AST, and deriving one that generates an AST annotated with the comments from the source file, so that they can be preserved for formatting.
Conversation
I think Makam has a bidirectional parser/pretty printer? I don't think it uses it for a code formatter though, and I don't think it preserves comments etc. It had a link to a paper in the source IIRC.
1
1
Seems to be based on "Invertible Syntax Descriptions: Unifying Parsing and Pretty Printing" by and : informatik.uni-marburg.de/~rendel/unpars

