[pypy-dev] How to translate 300000 lines of C

Armin Rigo arigo at tunes.org
Mon Jan 20 17:38:52 CET 2003


On Mon, Jan 20, 2003 at 03:16:00PM +0100, Christian Tismer wrote:
> >Whether automated or not, translating tested C code to Python seems
> >extremely difficult and risky.  It is risky because it implies one of two
> >speculative assumptions:
> >
> >1. The Python library will eventually outperform the C library or:
> >2. Guido will at some point approve supporting _two_ versions of the same
> >library.

I'm not sure these are the fundamental assumptions.  The goal we have here is
to write Python in Python.  The translator we are debating about is only a
tool to acheive this goal in a way that greatly helps keeping our source in
sync with CPython's.  In fact that's precisely because we don't want to
support two versions of the same code that we need some help from such a tool.

Again, it is out of question to design a tool that reliably translates 
arbitrary C code to Python.  The goal is to use simple rules and hand-made 
patterns to emit Python code, and then check *all* the emitted Python code and 
fine-tune it if needed --- with configuration scripts fed to the translator, 
not by directly changing the emitted Python code.

What we can then do with such a Python-in-Python interpreter (e.g. emit good C
code again) is another story.

A bientôt,


More information about the Pypy-dev mailing list