Well, unless you're reading Phil Dick, at least.
Just sent Python::Bytecode 2.6 to CPAN (knowing, bluntly, that I broke the tests) because the translator now works, at least for simple programs. Woohoo!
My first victim program was simple--the test shipped with Python::Bytecode. So this:
a = 2does, in fact, print
b = 3
if a:
print a, b
c = a + b
print c
2 3Go figure. I'm not sure which is more bizarre--the fact that it works, or the fact that I actually wrote correct Python code. (By the time this is all done I'm going to have to crank out a few pages of INTERCAL code to compensate.:)
5
I'm by no means done--assuming I've gotten it right, only 41 of the 110 ops are implemented, so I'd darned well better code faster, but...
Update 1: Make that 44 ops. Attribute get/set/delete is in, though we succeed in spots that Python throws errors.
Update 2: Make that 49 ops. Unary stuff and iterator getting, since it's easy. May have to check on setting an immutable true and false value, rather than a Boolean of the right truth value. We'll see if it matters.
Update 3: Make that 51 ops. PRINT_x_TO ops. And now it's past time for bed
Posted by Dan at July 16, 2004 12:28 AM | TrackBack (0)I'd put on a cheerleader outfit and cheer, but that wouldn't help you much. It's tough to code if you've gouged out your eyes...
Hooray!
Congratulations. You are doing a lot of impressive work here.
Posted by: Matt Fowles at July 16, 2004 11:15 AMSounds great.
Are you planning to implement binary module loading (.pyd) any time soon? I'm not sure if it's necessary for the pie-thon, but it looks like the python math module (for instance) would require it unless reimplemented.
awesome!
Posted by: timn at July 16, 2004 01:08 PMOn second thought I'm an idiot, because that would require implementing the entire CPython API.
Maybe the only choice is rewriting those modules for Parrot.
It's possible that at some point we'll build a thunking layer for CPython extension modules. It's probably possible for some portion of them, though it's always an open question whether 65% coverage means that 65% of the modules compile, or none of the modules compile because they all use that one function we can't implement.
The ponie folks are at work on a Perl 5 XS compatible layer. It's likely that, compared to that problem, the CPython API is relatively easy. Or at least less difficult, since it's unlikely to actually be easy.
Posted by: Dan at July 16, 2004 01:44 PM