Celli,
a C interpreter implemented on top of the PyPy interpreter make no sense
if you need speed ... IMHO.
A better aproach would be to bind the TCC library ( libtcc ->
http://bellard.org/tcc/tcc-doc.html#SEC22 ) to PyPy.
This library allows to compile on the fly and creates x86 executable
code in memory space ... no link actions, just call it with a library call.
Regards
--Armin
Celil wrote:
I have been thinking about the possibility of creating a C interpreter
in Python.
Is anybody already working on that? With PyPy this would presumably be
quite easy to do. The interpreter will load the C code, create an AST
(presumably using pyparsing and the EBNF spec of the C-language), and
then populate the Flow Object Space with all the C objects, and create
a control flow graph of the application logic. This graph will
containe low level lltype objects, and can then be directly connected
to the RPython flow-graph generated after the RTyper step. This would
allow for seamless interoperability between C and PyPy, and would also
greatly simplify the task of porting existing CPython extensions such
as numpy. Rather than going through the error prone task of
translating the whole code base into RPython, one will be able to
simply load the exiting C source code and integrate it directly into
the RPython flow graph. It will be possible to import *.h and *.c
files directly without any compilation, and they will run nearly as
fast thanks to PyPy's JIT technology.
This would also allow us to do things like running CPython on top of
PyPy. Right now it is possible to run PyPy on top of CPython, but the
reverse is not. If CPython could be run on top of PyPy by interpreting
its C source code that would be truly amazing. Interpreting C code
would greatly help CPython developers by freeing them from the task of
having to repeatedly compile their code.
Celil
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev