----- Original Message -----
From: "Michal Wallace" <[EMAIL PROTECTED]>
To: "Luke Palmer" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, July 24, 2003 12:01 PM
Subject: Re: approaching python


>
> On 24 Jul 2003, Luke Palmer wrote:
> > Klass-Jan Stol writes:
> > > module, right? I don't know Python, and I've a little experience
> > > with IMC, but it seems to me only a new code generator module should
>
> ...[snip]
>
> > Well... sortof.  It's definitely going to take writing a whole new
> > code generator module; it's not just a matter of getting the right
> > instructions.  Python's interpreter is stack-based, while Parrot's is
> > register-based, which are two very different kinds of data.
>
> Right. The implementation would be completely yanked out, but
> if we keep the code generator's interface, then that's the only
> file we have to touch.
>
> The other idea i had was a little crazy, but might make
> life a lot easier: if perl 6 can use pmcs directly,
> why not just compile it down to perl and let the perl
> compiler handle all the register stuff? [I honestly
> have no idea which way would be easier, since I don't
> realy know much about IMCC]

The register stuff, I presume, is register allocation and the like? When
targeting IMCC,
you can use an infinite amount of registers. Just keep a counter in the code
generator,
each time a new register is needed, just increment the counter and add a
"${S|N|I|P}" in front of it (example: $P1). IMCC does register allocation
and spilling.
So this is not really difficult.

It may be that this is not as efficient, because it adds an extra layer of
translation:

Python->Perl6->IMCC->PASM[1]

instead of

Python->IMCC->PASM

[1]. IMCC->PASM integrated in Parrot exec.

Klaas-Jan
>
> Also, there's an older project called rattlesnake that
> never really got off the ground. I don't know if any
> code was produced, but the point was to make a register
> based python vm. Maybe someone from that camp could help
> us out.
>
>
> > I think it would be good design to have the python binary parse for
> > us, but it's not likely practical.  Python has eval, so unless we
> > want to link with python, we should probably write our own
> > parser.[1]
>
> But there's already a parser written in python (in the
> pypython project), and it makes trees that work with the
> code generator. :) So I'm saying, use those tools, and
> just run the compiler from python until it's good enough
> to compile itself.
>
> That just seems like the quickest way to get python
> working.  (Of course, then there's all the C-based
> python modules, but that's another story)
>
> Sincerely,
>
> Michal J Wallace
> Sabren Enterprises, Inc.
> -------------------------------------
> contact: [EMAIL PROTECTED]
> hosting: http://www.cornerhost.com/
> my site: http://www.withoutane.com/
> --------------------------------------
>
>
>

Reply via email to