* not too much docs - you know why
* languages/python/t/*/*.t represents current state of implemented things
* in the absence of Python::Bytecode a short-term hack shows generated PIR assembly:
$ perl pie-thon.pl -dD some.py
To run some code:
$ perl pie-thon.pl some.py | parrot -j -Oc -
The tests are comparing output of Python 2.3.3 against Parrot's and are therefore more strict then the benchmarks themselves.
Have fun, leo
The Pie-thon state - 3
# date [- range ] title
# description
02.07.2004 Pie-thon 9 - ops, minimal translator
* a minimal Python translator based on dis.py
* python ops: print_item, print_newline
* IO interface to handle soft_space
* python test infrastructure
* some tests
* basic bigint parsing in lexer
02.07.2004 Pie-thon 10 - 13
Implement function calls, including default arguments.
02.07.2004 abs vtable and opcodes
C<abs> is different for complex, bigint, number and so on. So it
needs a vtable plus opcodes.
03.07.2004 - 08.07.2004 Pie-thon 12 - 33
Iterators, generators, tons more. Implement python builtins:
range(), map(), reduce(), enumerate() and so on.
Please read news:perl.cvs.perl6 for the whole story. Summary:
Parrot runs this code:
def pi():
k, a, b, a1, b1 = 2, 4, 1, 12, 4
n = 0
while 1:
p, q, k = k*k, 2*k+1, k+1
a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1
d, d1 = a//b, a1//b1
while d == d1:
n += 1
if n > 20:
return #raise StopIteration
yield d
a, a1 = 10*(a%b), 10*(a1%b1)
d, d1 = a//b, a1//b1
def main():
i = pi()
for y in i:
print y,
print
via:
$ perl pie-thon.pl pi.py | ../../parrot --python -j -Oc -
08.07.2004 Pie-thon 34 - the very first attribute: iterator.next()
pie-thon.pl converts LOAD_ATTR + CALL_FUNCTION to a NCI method
call, which invokes that method.
Iterating past the end of an aggregate throws now a StopIteration
exception. This code snippet runs now:
if __name__ == '__main__':
it = iter("abcde")
for i, c in enumerate(it):
print i, c
if i == 2:
break
print it.next()
print it.next()
try:
print it.next()
except StopIteration:
pass
print "Ok"
08.07.2004 Pie-thon 35 - 38
Implemented hash(), dict(), min(), max(), long() functions.
08.07.2004 Pie-thon 39 - repr
New get_repr vtable which defaults to get_strings. But for strings,
bigints and possibly others, the output is different. The repr()
functionality for aggregates will go through the freezer
interface, though
Adjusted method look up for PMCs that, as last resort, the namespace
"object" is consulted.
$P3."__repr__()
looks for the "__repr__" method in the PMCs class in its parents
and finally in the namespace "object".
For Python it'll have to look into properties too, finally, maybe.
09.07.2004 Pie-thon 40 - unicode string parsing and repr()
The lexer now recognices u:"string" constants, more precisely the
syntax is:
encoding-or-charset:"string"
but the encoding thingy isn't passed on yet.
09.07.2004 Pie-thon 41 - 44
More Bigint and Complex MMDs. bool() function for all types is
working. Python "short_slice" (RHS) for Arrays and strings done.
TODO
* finish bigint
* finish complex PMC class
* finish exception class hierarchy
* tons more
# vim: sw=4 tw=70:
