----- Original Message -----
From: "Benjamin Goldberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 24, 2003 6:07 PM
Subject: Re: approaching python

> K Stol wrote:
> >
> > ----- Original Message -----
> > From: "Michal Wallace" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, July 23, 2003 4:48 PM
> > Subject: approaching python
> >
> > >
> > > Hey all,
> > >
> > > I've been thinking about the "compiling python to
> > > parrot" concept. Right now it looks like the
> > > approach is to start from scratch, but I'm
> > > wondering if it might make more sense to
> > > leverage python itself, at least for now?
> > >
> > > Python has a compiler module (written in python
> > > and standard with the distribution) that can
> > > take a python parse tree and produce python
> > > byte code. It basically just walks the tree
> > > and has a method for each python structure.
> > >
> > > The actual parser is written in c, but there's
> > > a drop-in replacement (or at least a partial one)
> > > written in python described here:
> > >
> > >   http://codespeak.net/moin/pypy/moin.cgi/BytecodeCompiler
> > >
> > > Would it make sense to use this to boostrap the
> > > python parrot compiler? I was thinking about taking
> > > a shot next week at replacing compiler.pycodegen.CodeGenerator
> > > with something that produced IMCC.
> >
> > Correct me if I'm wrong, but there's no bootstrap problem, just a matter
> > of reimplementing the code generator.
>
> Except that you'd have to reimplement the code generator *in python* to
> produce parrot bytecode.
>
> Then run it once (on the python parser and code generator themselves)
> using the python executable, *then* you can run them using parrot.
>
> Sounds like bootstrapping to me. :P

Sounds like it's easy to solve the problem ;-)

It could be that my mind is somewhere different than the other people
discussing this.
I thought "Python->Parrot" is just a compiler that translates Python code to
ParrotVM (in practice this will generate IMC), and it *doesn't matter* in
what language this compiler is written in. So, if there is already a Python
parser, constructing a parse tree, I'd say, let's reconstruct the code
generator (indeed, only 1 file added/replaced), and if that has to be in
Parrot, so be it.

One more thing. The "compile at run-time" operation, for translating the
eval instruction needs a compiler, which will eventually be just a sub call
(if I understood the docs on that well). Then, it doesn't really matter if
that call is to a 'normal' sub, or if it's throught NCI, right?

Klaas-Jan

>
> --
> $a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
> );{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "[EMAIL PROTECTED]
> ]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
>

Reply via email to