First release of Shed Skin, a Python-to-C++ compiler.

Carl Friedrich Bolz cfbolz at gmx.de
Sun Sep 11 17:02:00 EDT 2005


Hi Mark!

Mark Dufour wrote:
>>>After nine months of hard work, I am proud to introduce my baby to the
>>>world: an experimental Python-to-C++ compiler. 
>>Wow, looks really cool.  But why that instead of Pypy?
> 
> I agree with anyone that a JIT compiler that supports the full Python
> semantics (which I thought to be the goal of PyPy?) is probably the
> best long term solution. It will really be a lot of work, however, and
> in general probably result in slower code than what my compiler
> produces, when it works (because of run-time overheads, lack of global
> optimizations.)

Although it is one of the goals of the PyPy project is producing a JIT 
for Python at some point in the future, it also contains a _static_ 
Python compiler right now: The whole source code of PyPy's interpreter 
is written in RPython, a restricted subset of the Python language. This 
subset is choosen in a way to make type inference possible and translate 
the code to a more low level language (at the moment C and LLVM are 
supported). This part of PyPy, the translator 
(http://codespeak.net/pypy/dist/pypy/doc/translation.html) has quite 
some similarities to Shed Skin. The kind of code that Shed Skin supports 
and RPython look quite similar (the biggest difference I see right now 
is that RPython supports exceptions). This was probably what Paul was 
referring to.

The translator is needed to translate the whole PyPy interpreter into a 
low level language to get speed back, so Shed Skin and the translator 
exist for the same reason.

> Considering that Shed Skin does what it does in only about 7500 lines
> (5500 without C++ implementations of builtins), and is extreme in both
> the requirements it puts on the compiler and in the speed of the
> resulting code, for me personally it is just a very appealing
> alternative to investigate (I like extremes :-)) It should work for
> many programs of the type I usually write (algorithms, compilers..),
> so it's also a case of scratching my own itch.

Shed Skin looks indeed quite impressive. If you are interested in 
discussing static translation of subsets of Python a bit or are even 
interested in getting to know PyPy a bit better feel free to contact us 
(http://codespeak.net/pypy/dist/pypy/doc/contact.html).

Cheers,

Carl Friedrich Bolz



More information about the Python-list mailing list