Skip to content

Option --dump-coreimp#3094

Closed
metaleap wants to merge 2 commits intopurescript:masterfrom
metaleap:master
Closed

Option --dump-coreimp#3094
metaleap wants to merge 2 commits intopurescript:masterfrom
metaleap:master

Conversation

@metaleap
Copy link
Copy Markdown

@metaleap metaleap commented Sep 26, 2017

New purs compile option --dump-coreimp, exactly like the existing --dump-corefn, to dump the CoreImp AST to a coreimp.json output file.

Requested in #876 and also in #711 in the comments

(The results can be seen in the various coreimp.json files throughout https://github.com/metaleap/gopure-demos/tree/master/01_hello_stranger/output )

New modules:

  • src/Language/PureScript/CoreImp/ToJSON.hs --- minimalist, modeled after the existing src/Language/PureScript/CoreFn/ToJSON.hs, same code conventions AFAICT. (Has duplicated the trivial tiny helper functions identToJSON and moduleNameToJSON as I didn't want to impress changes on to what the existing original exports.)

Existing modules:

  1. Merely duplications of the existing --dump-corefn option handling in:
  • app/Command/Compile.hs
  • src/Language/PureScript/Make.hs
  • src/Language/PureScript/Options.hs
    (Too small & trivial to generalize into helper funcs for now IMHO --- until a 3rd --dump-xyz request comes along in the future at least.)
  1. Minimal changes just to DeriveGeneric the 3 ToJSON instances for AST, UnaryOperator, BinaryOperator in:
  • src/Language/PureScript/CoreImp/AST.hs

@metaleap metaleap mentioned this pull request Sep 26, 2017
@metaleap
Copy link
Copy Markdown
Author

metaleap commented Sep 27, 2017

Disregard & discard, I made a better one in #3097 that doesn't modify CoreImp/AST.hs and has a somewhat easier-parseable JSON output format

@metaleap metaleap closed this Sep 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant