[pypy-dev] Python parsers...

holger krekel hpk at trillke.net
Thu Jul 31 00:31:37 CEST 2003


[Jeremy Hylton Wed, Jul 30, 2003 at 06:09:41PM -0400]
> > Hi all,
> > 	I have a Python parser done in "pure" Python (no C extension
> > module dependencies, etc...).  I even have an implementation of pgen in
> > Python.  Now, I am wondering what the next step is.  Shall I continue
> > onward to bytecode compilation?  Eventually, I am going to
> > need some instruction about integrating my code in with pypy.
> 
> Are you interested in integrating it into the compiler package?  The Python
> CVS trunk is now wide open for development, and the compiler package could
> definitely use some tidying up.

note, that we mirror the Python-CVS trunk into our svn-repository. 
This makes it easy to have a compiler-package within pypy and merge
back and fro with CPython's compiler package.  

However, i am not sure how many design goals a pypy-compiler and 
cpython-compiler will share in the longer run.  E.g. we probably 
want the pypy-compiler to be configurable at run time, e.g.

    from pypy import compiler
    compiler.set_minimal()  # only compile very basic constructs
    compiler.allow_listcomprehension()
    compiler.allow_classes()

    # set a different way to compile try/except/finally constructs [*]
    compiler.set_exception_compiler(MyExcCompiler)

    compiler.compile(testsource) # ...

and CPython's compiler package probably doesn't have such
design goals.  But then again, it wouldn't hurt if CPython's 
compiler package could do such things :-)

cheers,

    holger


[*] this e.g. means that a code object effectively determines opcode
    (and possibly frame) implementations.  Probably 'MyExcCompiler' 
    could just provide the implementations for its "own" opcodes 
    and the machinery would make them available at interpretation-time. 


More information about the Pypy-dev mailing list