[pypy-dev] output readable c
bookaa
rorsoft at gmail.com
Sat Apr 21 05:01:49 CEST 2012
yes, pypy's output c files is enough for c compilers. But its terrible if you want to read the c source codes.
I really very interest in make a python to c++ converter, based on pypy translator.
thanks
Bookaa
From: Alexander Pyattaev
Sent: Saturday, April 21, 2012 6:54 AM
To: pypy-dev at python.org
Subject: Re: [pypy-dev] output readable c
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 at 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 at 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
--------------------------------------------------------------------------------
_______________________________________________
pypy-dev mailing list
pypy-dev at python.org
http://mail.python.org/mailman/listinfo/pypy-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120421/0737dfd9/attachment-0001.html>
More information about the pypy-dev
mailing list