[Haskell-cafe] Re: Editors for Haskell
simonpj at microsoft.com
Thu Jun 8 04:19:57 EDT 2006
| > You probably know this, but your kind of application is a big reason
| > that we now make GHC available as a library. (Just say 'import
| > You shouldn't need to parse Haskell yourself: just call GHC's
| > You get back a syntax tree with very precise location information
| > can guide your editor (e.g. if you want to select a sub-exprssion).
| > Similarly, you can call the type checker.
| Are there any small examples of using GHC's parser? I'm a complete
| newbie so perhaps I'm not checking all of the relevant locations for
| docs, but I can't seem to find this parser that is being referred to.
| I checked out the source tree to GHC as well, but I have no idea where
| to look in there (not to mention it's a bit intimidating). Pointers
| would be appreciated!
The interface is exported by the module 'GHC', which is in GHC's sources
in main/GHC.hs. Sadly it does not have Haddock-ised documentation,
because Haddock isn't fully-featured enough to read GHC's source code.
(With a bit of luck the SoC project will fix that problem.)
Meanwhile, your best bet is to look at the interface and explore. There
a short web page giving an example of using GHC as a library here
Please add to it as you find out what to do!
| As part of my learning experience, I think I want to see if I can
| write a haskell pastebin that does proper syntax highlighting.
| Someone in #haskell suggested that I use just a lexer because using a
| parser is overkill. However, I can't make this assessment until I see
| how to use the parser and the information it can supply.
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
More information about the Haskell-Cafe