What is the purpose? For the target c/c++ compiler it is all the same, is not it? Or is the purpose to make a python->c++ converter?

Cheers,

Alex

perjantai 20 huhtikuu 2012 09:09:12 Maciej Fijalkowski kirjoitti:

On Fri, Apr 20, 2012 at 6:13 AM, gmail <rorsoft@gmail.com> wrote:

I find pypy translator output c files consist too many 'goto' statement.

Its hard to read and understand these c files.

I try to make it output with c keywords:

    if..else..

    while...break...continue

and now the output c file looks pretty better.

 

my pypy version is pypy-pypy-2346207d9946 download from:

    https://bitbucket.org/pypy/pypy/get/release-1.8.zip

 

 

test sample input file a2.py:

import sys

 

def entry_point(argv):
     a = [1,2,3,4]
     a.extend([4,5])
     print a
     return len(a)

 

def target(*args):
    return entry_point, None

 

if __name__ == '__main__':
    entry_point(sys.argv)

after run command:

    translator\goal\translate.py a2.py

 

I can find file a2.c in my temperary directory. The funcion pypy_g_entry_point in it is 662 lines and contains 103 goto.

 

after replace 2 attach files :

    pypy\translator\c\funcgen.py

    pypy\translator\c\bookaa_cpp.py

and run the command again, I get a2.c with pypy_g_entry_point is 539 lines and only contains 20 goto. 

 

I am still work hard try to improve pypy to get readable c++ output.

Anyone interest in this ?

 

Bookaa


_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev


Hi.


Your code does not contain any tests - we won't accept code that's untested. Second, please send your patches in diff format so we can have a better look on what you have changed (hg diff sounds like a good plan)


Cheers,

fijal