[Haskell-cafe] Re: Editors for Haskell
Simon Peyton-Jones
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
GHC'.)
| >
| > You shouldn't need to parse Haskell yourself: just call GHC's
parser.
| > You get back a syntax tree with very precise location information
that
| > 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
http://haskell.org/haskellwiki/GHC/As_a_library
Please add to it as you find out what to do!
simon
|
| 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.
|
| Thanks,
| Pete
|
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list