Python Compiler

Cedric Adjih adjih at crepuscule.com
Mon May 1 19:27:09 EDT 2000


Josh Tompkins <josht at iname.com> wrote:
> This is maybe a dumb question, but here goes: (donning asbestos underwear)

> What would be the difficulty of writing a real python compiler?  Or maybe a 
> compiler/interpreter similar to the one in VB?  Leaving platform indepenacy 
> and other similar concerns aside, what are the technical hurdles?  Is it 
> hard to write a compiler?  Given proper pointers to tutorials and 
> references I'd give it a shot, if it wasn't above my (low) level of 
> programming skill...

  The main problem I think is that Python data-structures are not
very well suited to compilation. Where one would have used 
a C fixed array, Python programs would use a list, appending each time.
The poor compiler would have to guess whether all the elements are
of the same type, and whether the number of elements is fixed and
computable, and whether there are funky operations like a[1:5]=[None]. 
It would have also problems to eliminate reference
counting for the most loop-intensive/simple structures code.

  The "compiler SIG" is where some of the efforts for a compiler
should appear: <http://www.python.org/sigs/compiler-sig/>

-- Cedric



More information about the Python-list mailing list