How can I make more readable the C code obtained from the PyPy translate
Hello. I am new to PyPy. I managed to write a few RPython programs and translate them with PyPy translate. As a few others have noticed, as well, (see for example http://mail.python.org/pipermail/pypy-dev/2010-December/006616.html, http://grokbase.com/t/python/pypy-dev/124mqreh2r/output-readable-c and https://bugs.pypy.org/issue1220), the generated C code is very cryptic (when compared to the input RPython script). As far as I understand, this is so because of the following facts: - the RPython code gets compiled to Python bytecode and then translated to more basic operations (an IR which I think it does not have a particular name in the PyPy toolchain - or does it? :) ) - heavy optimizations are being applied on this IR before generating code with the C backend. So, is there any simple way to generate more readable C code (more similar, if possible, to RPython script) - maybe some translate.py options I am missing? Thank you, Alex
Disclaimer: this is just my opinion and I'm not a pypy developer. I don't think what you want exists in pypy and I don't think it would be useful. If you need to look at the generated C code (why?), you may probably want to look at cython. On 05/09/2013 01:34 PM, RCU wrote:
Hello. I am new to PyPy.
I managed to write a few RPython programs and translate them with PyPy translate. As a few others have noticed, as well, (see for example http://mail.python.org/pipermail/pypy-dev/2010-December/006616.html, http://grokbase.com/t/python/pypy-dev/124mqreh2r/output-readable-c and https://bugs.pypy.org/issue1220), the generated C code is very cryptic (when compared to the input RPython script). As far as I understand, this is so because of the following facts: - the RPython code gets compiled to Python bytecode and then translated to more basic operations (an IR which I think it does not have a particular name in the PyPy toolchain - or does it? :) ) - heavy optimizations are being applied on this IR before generating code with the C backend.
So, is there any simple way to generate more readable C code (more similar, if possible, to RPython script) - maybe some translate.py options I am missing?
Thank you, Alex _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev
Hi Alex, On Thu, May 9, 2013 at 9:34 PM, RCU <alex.e.susu@gmail.com> wrote:
I managed to write a few RPython programs and translate them with PyPy translate.
I'm sure you've read the usual warning: http://doc.pypy.org/en/latest/faq.html#do-i-have-to-rewrite-my-programs-in-r... . This contains the implicit answer to your question: if your goal is not to get a good GC and JIT compiler for a dynamic language interpreter, but you focus more on getting readable C code from small RPython programs, then well, write your program in C in the first place... RPython is not designed to produce simple C code. A bientôt, Armin.
participants (3)
-
Armin Rigo
-
Davide Del Vento
-
RCU