[pypy-dev] How to translate 300000 lines of C
Edward K. Ream
edream at tds.net
Mon Jan 20 14:32:22 CET 2003
> On Mon, Jan 20, 2003 at 03:27:31AM +0100, Christian Tismer wrote:
> > I believe that it is possible to automate this translation
> > process!
>
> Yes! I think it is a very good idea. I would certainly be much more
happy
> with keeping a reasonable-sized translator up-to-date than having to do so
> with the huge C code base.
In a private email to Christian I suggested making this whole problem go
away by changing the name of this project from minimalPython to
psycoticPython :-)
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 view assumption 2 as having almost zero probability, though of course I
don't speek for Guido in any way. The reason is plain: it is odious to keep
two sets of source code in synch.
That leaves assumption 1. No point in arguing over the probabilities of it
now: let's assume it is will be proved correct. I would be inclined to pick
_one_ module to work on as a test bed. Translation can be done by hand. We
can then test assumption 1.
The bigger translation problem becomes real only if assumption 1 is proved
to be true. Even then, I would imagine a _lengthy_ probationary period for
each translated module before it becomes accepted into the library. So it
isn't so important how long translation takes; the translation process is
much less important than the testing process.
My script c2py.py works only on translating C to Python syntax. It's
complex enough. The hisory of machine translation of natural languages is
littered with initial failure, in some cases with limited success after
decades of work. Myself, I wouldn't invest any time at all in automatically
translating C semantics to Python semantics. YMMV.
Edward
--------------------------------------------------------------------
Edward K. Ream email: edream at tds.net
Leo: Literate Editor with Outlines
Leo: http://personalpages.tds.net/~edream/front.html
--------------------------------------------------------------------
More information about the Pypy-dev
mailing list