pretty newby
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Wed Sep 24 18:00:55 EDT 2003
John Hughes <rjmh at cs.chalmers.se> writes:
> The problem is that parsers in compilers don't keep track of comments.
> Instead they discard them at the first opportunity (during lexing).
> ... What's needed is a parser that can parse
> comments, and tie them to the *right place* in the abstract syntax tree.
Fortunately, there *is* one Haskell parser already which preserves
comments in the source code and links them properly to the surrounding
program structure, namely Haddock, the automatic-documentation
generator. I expect Haddock would be a good place to start if one
wanted to develop a program re-formatter.
(Furthermore, if one were to add a type inference engine that
could fill-in missing type signatures in a program, that would be
highly useful for both Haddock and the hypothetical re-formatter.)
Regards,
Malcolm
More information about the Haskell
mailing list