<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=utf-8 http-equiv=Content-Type>
<META name=qrichtext content=1>
<STYLE type=text/css>
p, li { white-space: pre-wrap; }
</STYLE>

<META name=GENERATOR content="MSHTML 8.00.7600.16466"></HEAD>
<BODY 
style="FONT-STYLE: normal; PADDING-LEFT: 10px; PADDING-RIGHT: 10px; FONT-FAMILY: 'Terminus'; FONT-SIZE: 11pt; FONT-WEIGHT: 400; PADDING-TOP: 15px" 
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true" 
name="Compose message area">
<DIV><FONT size=3 face=Calibri>yes, pypy's output c files is enough for c 
compilers. But its terrible if you want to read the c source codes.</FONT></DIV>
<DIV><FONT size=3 face=Calibri>I really very interest in make a python to c++ 
converter, based on pypy translator.</FONT></DIV>
<DIV><FONT size=3 face=Calibri></FONT>&nbsp;</DIV>
<DIV><FONT size=3 face=Calibri>thanks</FONT></DIV>
<DIV><FONT size=3 face=Calibri>Bookaa</FONT></DIV>
<DIV style="FONT: 10pt Tahoma">
<DIV><BR></DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=alexander.pyattaev@tut.fi 
href="mailto:alexander.pyattaev@tut.fi">Alexander Pyattaev</A> </DIV>
<DIV><B>Sent:</B> Saturday, April 21, 2012 6:54 AM</DIV>
<DIV><B>To:</B> <A title="mailto:pypy-dev@python.org&#10;CTRL + 单击以下链接" 
href="mailto:pypy-dev@python.org">pypy-dev@python.org</A> </DIV>
<DIV><B>Subject:</B> Re: [pypy-dev] output readable c</DIV></DIV></DIV>
<DIV><BR></DIV>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0">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-&gt;c++ converter?</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0">Cheers,</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0">Alex</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0">perjantai 
20 huhtikuu 2012 09:09:12 Maciej Fijalkowski kirjoitti:<BR></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 12px 40px; -qt-block-indent: 0; -qt-user-state: 0">On 
Fri, Apr 20, 2012 at 6:13 AM, gmail &lt;<A href="mailto:rorsoft@gmail.com"><SPAN 
style="COLOR: #0057ae; TEXT-DECORATION: underline">rorsoft@gmail.com</SPAN></A>&gt; 
wrote:<BR></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">I find pypy translator output c files consist too 
many 'goto' statement.</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">Its hard to read and understand these c 
files.</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">I try to make it output with c 
keywords:</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp;&nbsp;&nbsp;&nbsp;if..else..</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp;&nbsp;&nbsp;&nbsp;while...break...continue</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">and now the output c file looks pretty 
better.</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'"></SPAN>&nbsp;</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">my pypy version is pypy-pypy-2346207d9946 
download from:</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp;&nbsp;&nbsp;&nbsp;</SPAN><SPAN 
style="FONT-FAMILY: 'Calibri'">https://bitbucket.org/pypy/pypy/get/release-1.8.zip</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'"></SPAN>&nbsp;</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'"></SPAN>&nbsp;</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">test sample input file a2.py:</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 12px 0px 0px 40px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">import sys </SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp; </SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 0px 0px 40px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">def 
entry_point(argv):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a = 
[1,2,3,4]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a.extend([4,5])<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print 
a<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return len(a) </SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp; </SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 0px 0px 40px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">def target(*args):<BR>&nbsp;&nbsp;&nbsp; return 
entry_point, None </SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp; </SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 0px 0px 40px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">if __name__ == '__main__':<BR>&nbsp;&nbsp;&nbsp; 
entry_point(sys.argv)<BR></SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">after run command:</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp;&nbsp;&nbsp;&nbsp;translator\goal\translate.py 
a2.py</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'"></SPAN>&nbsp;</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">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.</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'"></SPAN>&nbsp;</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">after replace 2 attach files&nbsp;: </SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp;&nbsp;&nbsp;&nbsp;pypy\translator\c\funcgen.py</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">&nbsp;&nbsp;&nbsp;&nbsp;pypy\translator\c\bookaa_cpp.py</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">and run the command again, I get a2.c with 
</SPAN><SPAN style="FONT-FAMILY: '宋体'">pypy_g_entry_point is 539 lines and only 
contains 20 goto.</SPAN><SPAN style="FONT-FAMILY: 'Calibri'">&nbsp;</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'"></SPAN>&nbsp;</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">I am still work hard try to improve pypy to 
get&nbsp;readable c++ output.</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">Anyone interest in this ?</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'"></SPAN>&nbsp;</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><SPAN 
style="FONT-FAMILY: 'Calibri'">Bookaa</SPAN></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><BR>_______________________________________________<BR>pypy-dev 
mailing list<BR><A href="mailto:pypy-dev@python.org"><SPAN 
style="COLOR: #0057ae; TEXT-DECORATION: underline">pypy-dev@python.org</SPAN></A><BR><A 
href="http://mail.python.org/mailman/listinfo/pypy-dev"><SPAN 
style="COLOR: #0057ae; TEXT-DECORATION: underline">http://mail.python.org/mailman/listinfo/pypy-dev</SPAN></A><BR><BR></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><BR></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 40px; -qt-block-indent: 0; -qt-user-state: 0">Hi.</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 40px; -qt-block-indent: 0; -qt-user-state: 0"><BR></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 40px; -qt-block-indent: 0; -qt-user-state: 0">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) </P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 40px; -qt-block-indent: 0; -qt-user-state: 0"><BR></P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 40px; -qt-block-indent: 0; -qt-user-state: 0">Cheers,</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px 40px; -qt-block-indent: 0; -qt-user-state: 0">fijal</P>
<P 
style="TEXT-INDENT: 0px; MARGIN: 0px; -qt-block-indent: 0; -qt-user-state: 0"><BR><BR></P>
<P>
<HR>

<P></P>_______________________________________________<BR>pypy-dev mailing 
list<BR>pypy-dev@python.org<BR>http://mail.python.org/mailman/listinfo/pypy-dev<BR></BODY></HTML>