<div dir="ltr">Hello,<div><br></div><div>I have not done what you are asking, but here is how I'd approach the problem. </div><div><br></div><div><div>1. Assuming you already have some Core, you'd have to figure out how to include it with the rest of the GHC pipeline:</div><div> * A lot of the code that glues everything together is in `compiler/main`. Modules of interest seem to be `DriverPipeline`, `HscMain`, and `PipelineMoand`</div><div> * A quick looks suggests that maybe you want to call `hscGenHardCode` in `HscMain`, with your core program inside the `CgGuts` argument.</div></div><div> * Exactly how you setup things probably depends on how much of the rest of the Haskell ecosystem you are trying to integrate with (separate compilation, avoiding recompilation, support for packages, etc.)</div><div><br></div><div>2. The syntax for Core is in `compiler/coreSyn`, with the basic AST being in module `CoreSyn`. Module `MkCore` has a lot of helpers for working with core syntax.</div><div><br></div><div>3. The "desugarer" (in `compiler/deSugar`) is the GHC phase that translates the front end syntax (hsSyn) into core, so that should have lots of examples of how to generate core.</div><div><br></div><div>Cheers,</div><div>-Iavor</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 22, 2018 at 1:46 AM Ara Adkins <<a href="mailto:me@ara.io">me@ara.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hey All,</div><div><br></div><div>I was chatting to SPJ about the possibility of using GHC Core + the rest of the GHC compilation pipeline as a target for a functional language, and he mentioned that asking here would likely be more productive when it comes to the GHC API.</div><div><br></div><div>I'm wondering where the best place would be for me to look in the API for building core expressions, and also whether it is possible to trigger the GHC code-generation pipeline from the core stage onwards.</div><div><br></div><div>Best,</div><div>Ara<br></div></div>
_______________________________________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs</a><br>
</blockquote></div>