Re: [pypy-dev] Who's developing language interpreters in PyPy

Well, you can always try to build a dynamically extensible Pascal environment with automatic memory management :-)
Pascal? A nice university language for its time, but the type system makes practical use an absurd attempt (cf http://www.cs.virginia.edu/~evans/cs655-S00/readings/bwk-on-pascal.html)
Which reminds me to mention that a Smalltalk environment would be a nice project in PyPy.
What about a C/C++ interpreter/compiler, there would be some real benefit if people could transpile C code to python. Plus, there's an existing C interpreter project out there, maybe there is a way to reuse some parts or at least some ideas of it. (This is probably too big a project for one person, but if there's any interest in this I'd be happy to join :-).

Robert Schmitt wrote:
What about a C/C++ interpreter/compiler, there would be some real benefit if people could transpile C code to python.
To be honest, I don't see how a C-to-Python-compiler a) relates to PyPy and b) why it would be useful. What real benefit do you see there? Interfacing to C/C++ code is not that hard in CPython, and PyPy is getting there too. Such a compiler would also be quite hard, since C/C++ allow all sorts of crazy unsafe things, so you would end up doing something like described in the paper "Complete Translation of Unsafe Native Code to Safe Bytecode" by Brian Alliet and Adam Megacz.
You mean CINT? Quite crashy, in my experience. Which does not make it a less impressive (but very very crazy) thing :-)

Carl Friedrich Bolz schrieb:
To be honest, I don't see how a C-to-Python-compiler a) relates to PyPy and b) why it would be useful. What real benefit do you see there?
Such a module would not have to be part of pypy, but it could make quite good use of the machinery already in place.
There certainly is a way to access python from C/C++ and vice versa, so that is not my concern. But going one step further would be really beneficial: Getting legacy C code to a platform where it can be used, test-infected, and refactored, that would be cool. On the other hand, I totally agree with you that it would be quite a crazy endeavor - then again, what's life without a challenge :-) Taking the approach of the paper would probably be easier than translating the source, but I don't see a benefit unless you use the symbolic intermediate data generated by the compiler so you can generate readable code in the end - or do I misunderstand the pypy architecture, can't you generate rpython output with it?

On Tue, 24 Apr 2007 10:58:19 +0200 Carl Friedrich Bolz <cfbolz@gmx.de> wrote:
Being able to run optimisations that include external C libraries. This is what the llvm guys can do with the gcc front end, i believe. hmm, perhaps it then makes sense to build a llvm frontend :) Simon.

Robert Schmitt wrote:
What about a C/C++ interpreter/compiler, there would be some real benefit if people could transpile C code to python.
To be honest, I don't see how a C-to-Python-compiler a) relates to PyPy and b) why it would be useful. What real benefit do you see there? Interfacing to C/C++ code is not that hard in CPython, and PyPy is getting there too. Such a compiler would also be quite hard, since C/C++ allow all sorts of crazy unsafe things, so you would end up doing something like described in the paper "Complete Translation of Unsafe Native Code to Safe Bytecode" by Brian Alliet and Adam Megacz.
You mean CINT? Quite crashy, in my experience. Which does not make it a less impressive (but very very crazy) thing :-)

Carl Friedrich Bolz schrieb:
To be honest, I don't see how a C-to-Python-compiler a) relates to PyPy and b) why it would be useful. What real benefit do you see there?
Such a module would not have to be part of pypy, but it could make quite good use of the machinery already in place.
There certainly is a way to access python from C/C++ and vice versa, so that is not my concern. But going one step further would be really beneficial: Getting legacy C code to a platform where it can be used, test-infected, and refactored, that would be cool. On the other hand, I totally agree with you that it would be quite a crazy endeavor - then again, what's life without a challenge :-) Taking the approach of the paper would probably be easier than translating the source, but I don't see a benefit unless you use the symbolic intermediate data generated by the compiler so you can generate readable code in the end - or do I misunderstand the pypy architecture, can't you generate rpython output with it?

On Tue, 24 Apr 2007 10:58:19 +0200 Carl Friedrich Bolz <cfbolz@gmx.de> wrote:
Being able to run optimisations that include external C libraries. This is what the llvm guys can do with the gcc front end, i believe. hmm, perhaps it then makes sense to build a llvm frontend :) Simon.
participants (3)
-
Carl Friedrich Bolz
-
Robert Schmitt
-
Simon Burton