Expose Other Parsers for GHC API

Simon Peyton Jones simonpj at microsoft.com
Sun Jun 1 20:10:35 UTC 2014

It sounds ok to me, especially if you take the time to Haddock-document them.

It’d also be great to improve the user-generated documentation about the GHC API
perhaps you can add a section about the stuff that you add.



From: ghc-devs [mailto:ghc-devs-bounces at haskell.org] On Behalf Of Andrew Gibiansky
Sent: 31 May 2014 04:09
To: ghc-devs at haskell.org
Subject: Expose Other Parsers for GHC API


I would like to be able to use the GHC API for parsing. Right now this is in the Parser and Lexer modules:

Parser: http://www.haskell.org/ghc/docs/7.8.2/html/libraries/ghc-7.8.2/Parser.html
Lexer: http://www.haskell.org/ghc/docs/7.8.2/html/libraries/ghc-7.8.2/Lexer.html

GHC currently exposes only a few parsers here. I'd like to make a few modifications:

1. Expose a few more parsers than currently are exposed in the Parser module. In particular, I'd like import statements, type signatures, declarations, and expressions, at least, in addition to what's already there.

2. Re-export some things from Lexer from Parser, since they're reused. This would include unP, PState, and the 2-3 other core things you have to use in order to use the GHC Parser.

3. Add some Haddock documentation to the top of the Parser module describing how to use it, since the types themselves are pretty opaque here.

I think (1) and (3) are definitely a good idea, not so sure about (2) though IMHO it would be convenient for using the Parser.

Would this make for an acceptable patch? Thoughts?

-- Andrew Gibiansky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20140601/4be9ae45/attachment-0001.html>

More information about the ghc-devs mailing list