[pypy-dev] output readable c

gmail rorsoft at gmail.com
Fri Apr 20 06:13:50 CEST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120420/91a8560e/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bookaa_cpp.py
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120420/91a8560e/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: funcgen.py
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120420/91a8560e/attachment-0003.ksh>


More information about the pypy-dev mailing list