[Haskell-cafe] STG's? [was: I want to write a compiler]

Rick R rick.richardson at gmail.com
Sun Mar 8 19:16:46 EDT 2009


Where can I find more information on STGs? Google search doesn't bring up
anything too enlightening.

My curiosity was piqued by http://www.cs.chalmers.se/~gedell/ssc/index.html.
Of course it doesn't indicate how these should be built or the format.


On Sun, Mar 8, 2009 at 6:41 PM, Loup Vaillant <loup.vaillant at gmail.com>wrote:

> Thanks to the courage you all gave me, I found the strength to go on.
>
> Template instantiation seems to be the easiest path, so I decided to
> follow it. I think I solved the problem about primitives and FFI I
> though it had. Namely, how the hell do I compile primitive calls with
> an arbitrary number of arguments.
>
> Starting from the Tutorial of Peyton Jones and Lester, I added a new
> node type to help guide the order of evaluation. Basically, this "Seq"
> node takes the address of two other nodes. It pushes them both on the
> stack, like an application node would. (That is because I don't want a
> dump, but I could as well create a new stack and and push the previous
> one on the dump.)
>
> Note the nodes which are evaluated this way must not have a functional
> head normal form (primitive or supercombinator). That would leak past
> the beginning of the stack.
>
> When the node is finally evaluated (e.g. points to a HNF, like a boxed
> integer), the topmost and second topmost pointers on the stack are
> swapped. (or the topmost pointer of the stack and the topmost pointer
> of the topmost stack on the dump are swapped).
>
> With a suitable compilation scheme, that should guarantee that
> primitives have their arguments already evaluated. (And avoid infinite
> loops).
>
> Now, I just have to implement it. :-)
>
> Cheers,
> Loup.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
We can't solve problems by using the same kind of thinking we used when we
created them.
   - A. Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090308/6f743b55/attachment.htm


More information about the Haskell-Cafe mailing list