Heya,

Those are exactly the kind of pointers I was hoping for. Thanks Iavor. 

I’m sure I’ll have more questions with time, but that’s a great starting point. 

_ara

> On 25 Oct 2018, at 19:20, Iavor Diatchki <[email protected]> wrote:
> 
> Hello,
> 
> I have not done what you are asking, but here is how I'd approach the 
> problem.   
> 
> 1. Assuming you already have some Core, you'd have to figure out how to 
> include it with the rest of the GHC pipeline:
>     * A lot of the code that glues everything together is in `compiler/main`. 
> Modules of interest seem to be `DriverPipeline`, `HscMain`, and 
> `PipelineMoand`
>     * A quick looks suggests that maybe you want to call `hscGenHardCode` in 
> `HscMain`, with your core program inside the `CgGuts` argument.
>     * 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.)
> 
> 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.
> 
> 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.
> 
> Cheers,
> -Iavor
> 
> 
> 
> 
> 
> 
> 
>> On Mon, Oct 22, 2018 at 1:46 AM Ara Adkins <[email protected]> wrote:
>> Hey All,
>> 
>> 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.
>> 
>> 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.
>> 
>> Best,
>> Ara
>> _______________________________________________
>> ghc-devs mailing list
>> [email protected]
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________
ghc-devs mailing list
[email protected]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to