An update: I just rebased wip-rtl-cps on top of wip-rtl-may-2013 and pushed. The most interesting thing was how trivial it was: all I had to do was make a one-line change in how I called `begin-program'.

Best,
Noah


On Wed, May 22, 2013 at 12:33 AM, Noah Lavine <noah.b.lavine@gmail.com> wrote:
Hello,

On Tue, May 21, 2013 at 3:46 PM, Andy Wingo <wingo@pobox.com> wrote:
You should have two names: the original ones and the gensyms that come
from tree-il.  Creating new gensyms should happen when copying or
fabricating new nodes, as peval does, but in most cases you don't need
to do it, and in any case it can be tricky.

I would take tree-il as the guide here.

I'll look at it, thanks.
 
I haven't handled source information yet, but to the CPS->RTL compiler
it will look like emitting special instructions, like the tree-il->glil
compiler emits <glil-source> nodes.

That sounds fairly simple to implement.
 
This is lambda-properties.  You just pass them through, and add them to
the begin-program in the RTL.

Again, this seems relatively simple to do.
 
Note that wip-rtl-may-2013 and the RTL branches that are under review
for master are slightly different from the ones you have.  Their
begin-program has a second argument, the procedure properties, and the
first argument is a label and not a name.  They have begin-*-arity and
end-arity for marking arity information and performing arity prologues.
There are some slight changes to instructions but not much.  OTOH they
do have some better type checking and a disassembler that works, so many
things should be easier ;) Compare the rtl.test there and your rtl.test
for details.

>       * Why is there no "let" that can bind functions?  You don't always
>     want
>        to set up a recursive binding environment.

I think right now the Tree-IL->CPS compiler will turn (let ((f (lambda ...))) ...) into something like this:

((lambda (f-12345)
  .... let body here ....)
 (letrec ((f-func (lambda ... f's body here ...))) f-func))

(I'm not showing the continuation's name because it would make it even more complicated than it already is.)

I agree that this is a crazy way to do it. It should detect this case and skip the extra steps.
 
Understood.  However the question of language is fundamental for
enabling collaboration on this code.  I would be very happy to see a CPS
language definition that could express all of Tree-IL.  I don't think
this would take a lot of work -- it is perfectly acceptable to throw
"unimplemented" for those parts of the compiler that aren't there yet,
but the language itself should be adequately expressive.  IMHO anyway.

Do you think you will have time to do that over the next few days or so?
Apologies for the pressure, just that I would like to do some things in
this area and am not sure how best to do them :)

This is interesting - I had been adding to the language as I needed features, and not really thinking of it as an interface. But you might be right. I just started rebasing tonight, and I hope to work more on it in the next two days. But I don't want to be a blocker for your work - what are you trying to do?
 
Thanks a lot,
Noah