Expose Other Parsers for GHC API

Andrew Gibiansky andrew.gibiansky at gmail.com
Sat May 31 03:09:05 UTC 2014


Hello,

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/20140530/a59aff32/attachment.html>


More information about the ghc-devs mailing list