first release of PyPy
Carl Friedrich Bolz
cfbolz at gmx.de
Sat May 21 06:14:58 EDT 2005
Hi!
Ville Vainio wrote:
>>>>>>"Torsten" == Torsten Bronger <bronger at physik.rwth-aachen.de> writes:
>
>
> Torsten> What's supposed to be compiled? Only PyPy itself or also
> Torsten> the programs it's "interpreting"?
>
> PyPy is written in python, if it can be compiled then the programs can
> be as well.
That's correct in the sense that if a program adherses to the same
staticness conditions as the PyPy code, it can be compiled. The core
parts of the PyPy interpreter are written in "Restricted Python"
(RPython), which imposes some limits to the features you are allowed to
use. This is done in such a way that the annotator can perform type
inference, e.g. you are not allowed to assign values with different
types to a variable (plus some more restrictions). See
http://codespeak.net/pypy/index.cgi?doc/coding-guide.html#restricted-python
for more details about RPython.
>
> Torsten> I've been told by so many books and on-line material that
> Torsten> Python cannot be compiled (unless you cheat). So how is
> Torsten> this possible?
>
> These guys are exploring a new territory. OTOH, Lisp is a dynamic
> language like python and it can be compiled to native code. Pyrex
> demonstrates the "trivial" way to compile python to native code, the
> real problem is making the resulting code fast. Typically this
> requires type inference (i.e. figuring out the type of an object from
> the context because there are no type declarations) to avoid dict
> lookups in method dispatch.
There is some preliminary documentation about the type infering (which
is called annotation here) and the translation process:
http://codespeak.net/pypy/index.cgi?doc/translation.html
Regards,
Carl Friedrich
More information about the Python-list
mailing list