Adds the ability to use the parser without DynFlags
ClosedPublic

Authored by dalaing on May 12 2016, 7:35 PM.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dalaing updated this revision to Diff 7562.May 12 2016, 7:35 PM
dalaing retitled this revision from to Adds the ability to use the parser without DynFlags (#10961).
dalaing updated this object.
dalaing edited the test plan for this revision. (Show Details)
simonmar edited edge metadata.EditedMay 13 2016, 4:50 AM

I think you need to add CmmMonad to compiler/ghc.cabal.in.

simonmar accepted this revision.EditedMay 13 2016, 4:56 AM
simonmar edited edge metadata.

The fiddling around in the Cmm parser is kind of annoying, and the fact that you can't do anything with the warning messages without having a DynFlags is also a bit of a wart. But I guess I'm not strongly opposed to this. Ultimately I think we should split out the Settings from DynFlags, but this is OK in the meantime.

Just fix the ghc.cabal.in before committing, and ensure it validates.

This revision is now accepted and ready to land.May 13 2016, 4:56 AM

The mess with messages will be able to be cleaned up once we have a fix for Trac #10143, which I'll take a look at next if I have time.

dalaing updated this revision to Diff 7573.May 13 2016, 5:44 AM
dalaing edited edge metadata.
bgamari retitled this revision from Adds the ability to use the parser without DynFlags (#10961) to Adds the ability to use the parser without DynFlags.May 13 2016, 6:35 AM
bgamari edited edge metadata.
bgamari updated the Trac tickets for this revision.
bgamari edited edge metadata.May 13 2016, 6:45 AM

Hi @dalaing!

Thanks for doing this; it is a shame that the parser has remained so hard to use for so long. I'm very happy to hear you might look at Trac #10143; that will be a tremendous improvement.

Looks good to me!

compiler/cmm/CmmMonad.hs
15

A doc comment somewhere in this module explaining the motivation for its introduce and where it is used would be nice.

compiler/parser/Lexer.x
1753

Perhaps make this a haddock comment?

bgamari accepted this revision.May 13 2016, 6:45 AM
bgamari edited edge metadata.
alanz accepted this revision.May 13 2016, 6:55 AM
alanz edited edge metadata.

This makes it much easier to use the parser outside of GHC

Hey @bgamari - thanks for the feedback.

I meant to add docs, but figured I'd push the change I had up here to get a sanity check first.

I'll take care of the docs the next time I get a chance.

dalaing updated this revision to Diff 7584.May 14 2016, 10:55 PM
dalaing edited edge metadata.
dalaing updated this revision to Diff 7585.May 14 2016, 10:59 PM
dalaing edited edge metadata.
dalaing marked 2 inline comments as done.May 16 2016, 8:51 PM

I added some minor documentation over the weekend - let me know if more is required.

thomie accepted this revision.May 17 2016, 12:09 AM
thomie added a reviewer: thomie.

Macro shipitquick:

Thanks again @dalaing, great work!

This revision was automatically updated to reflect the committed changes.