[Haskell-cafe] Compiling a DSL on the shoulders of GHC

Josef Svenningsson josef.svenningsson at gmail.com
Mon Oct 18 03:48:00 EDT 2010


Fiddling with GHC internals sounds like overkill for this project.

Are you really sure you need a timeout to run the Haskell metaprogram? There
are many implementations of EDSLs which take the approach that you want to
take by using Haskell to create a syntax tree and the offshore it to some
backend compiler. None of them uses a timeout.

But in case you really insist on a timeout I would recommend using a wrapper
function on the toplevel of your metaprogram which implements the timeout.
That way you don't have to risk your sanity by having to dig around in GHC.

Josef

On Sun, Oct 17, 2010 at 9:53 PM, Patai Gergely <patai_gergely at fastmail.fm>wrote:

> > Not sure how this fits into what I thought you were saying.  Are you
> > trying to use Haskell to build an AST, use GHC to optimize it, and
> > then spit it out and compile it with, say, a OCaml program that you
> > have already written?
> Yes, that would be the basic idea:
>
> 1. Compile the Haskell metaprogram.
> 2. Evaluate main, possibly with a timeout, in a way that keeps all its
> structure including lambdas accessible (e.g. Core).
> 3. Compile the resulting program with other tools.
>
> > What is this different tool and how does it fit in to your pipeline?
> This tool(set) is a specialised compiler for some low-level target
> platform (FPGA, DSP, GPU - again, no clear decision yet), and it is the
> second half of the pipeline after the GHC phases.
>
> Gergely
>
> --
> http://www.fastmail.fm - The professional email service
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101018/0ce29375/attachment.html


More information about the Haskell-Cafe mailing list