-Translating the flow graph to CLI or JVM code
-PyPy also contains a `CLI backend`_ and JVM backend which
-can translate flow graphs into .NET executables or a JVM jar
-file respectively. Both are able to translate the entire
-interpreter. You can try out the CLI and JVM backends
-from the interactive translator shells as follows::
- >>> def myfunc(a, b): return a+b
- >>> t = Translation(myfunc, [int, int])
- >>> f = t.compile_cli() # or compile_jvm()
-The object returned by ``compile_cli`` or ``compile_jvm``
-is a wrapper around the real
-executable: the parameters are passed as command line arguments, and
-the returned value is read from the standard output.
-Once you have compiled the snippet, you can also try to launch the
-executable directly from the shell. You will find the
-executable in one of the ``/tmp/usession-*`` directories::
- $ mono /tmp/usession-trunk-<username>/main.exe 4 5
- $ java -cp /tmp/usession-trunk-<username>/pypy pypy.Main 4 5
-To translate and run for the CLI you must have the SDK installed: Windows
-users need the `.NET Framework SDK`_, while Linux and Mac users
-can use Mono_. To translate and run for the JVM you must have a JDK
-installed (at least version 6) and ``java``/``javac`` on your path.
A slightly larger example
There are several environment variables you can find useful while playing with the RPython:
- RPython uses temporary session directories to store files that are generated during the
+ RPython uses temporary session directories to store files that are generated during the
translation process(e.g., translated C files). ``PYPY_USESSION_DIR`` serves as a base directory for these session
dirs. The default value for this variable is the system's temporary dir.
- By default RPython keeps only the last ``PYPY_USESSION_KEEP`` (defaults to 3) session dirs inside ``PYPY_USESSION_DIR``.
+ By default RPython keeps only the last ``PYPY_USESSION_KEEP`` (defaults to 3) session dirs inside ``PYPY_USESSION_DIR``.
Increase this value if you want to preserve C files longer (useful when producing lots of lldebug builds).
.. _`your own interpreters`: faq.html#how-do-i-compile-my-own-interpreters
-.. _`start reading sources`:
+.. _`start reading sources`:
Where to start reading the sources
PyPy is made from parts that are relatively independent of each other.
You should start looking at the part that attracts you most (all paths are
-relative to the PyPy top level directory). You may look at our `directory reference`_
+relative to the PyPy top level directory). You may look at our `directory reference`_
or start off at one of the following points:
* `pypy/interpreter`_ contains the bytecode interpreter: bytecode dispatcher
in `pypy/interpreter/pyopcode.py`_, frame and code objects in `pypy/interpreter/eval.py`_ and `pypy/interpreter/pyframe.py`_,
function objects and argument passing in `pypy/interpreter/function.py`_ and `pypy/interpreter/argument.py`_,
the object space interface definition in `pypy/interpreter/baseobjspace.py`_, modules in
- `pypy/interpreter/module.py`_ and `pypy/interpreter/mixedmodule.py`_. Core types supporting the bytecode
+ `pypy/interpreter/module.py`_ and `pypy/interpreter/mixedmodule.py`_. Core types supporting the bytecode
interpreter are defined in `pypy/interpreter/typedef.py`_.
* `pypy/interpreter/pyparser`_ contains a recursive descent parser,
.. _`RPython standard library`: rlib.html
Running PyPy's unit tests
# or for running tests of a whole subdirectory
-See `py.test usage and invocations`_ for some more generic info
+See `py.test usage and invocations`_ for some more generic info
on how you can run tests.
Beware trying to run "all" pypy tests by pointing to the root
.. _`interpreter-level and app-level`: coding-guide.html#interpreter-level
Tracing bytecode and operations on objects
You can use the trace object space to monitor the interpretation
-of bytecodes in connection with object space operations. To enable
-it, set ``__pytrace__=1`` on the interactive PyPy console::
+of bytecodes in connection with object space operations. To enable
+it, set ``__pytrace__=1`` on the interactive PyPy console::
.. _`example-interpreter`: https://bitbucket.org/pypy/example-interpreter
-Additional Tools for running (and hacking) PyPy
+Additional Tools for running (and hacking) PyPy
-We use some optional tools for developing PyPy. They are not required to run
+We use some optional tools for developing PyPy. They are not required to run
the basic tests or to get an interactive PyPy prompt but they help to
-understand and debug PyPy especially for the translation process.
+understand and debug PyPy especially for the translation process.
graphviz & pygame for flow graph viewing (highly recommended)
graphviz and pygame are both necessary if you
-want to look at generated flow graphs:
+want to look at generated flow graphs:
- graphviz: http://www.graphviz.org/Download.php
+ graphviz: http://www.graphviz.org/Download.php
The `py.test testing tool`_ drives all our testing needs.
You don't necessarily need to install these two libraries because
we also ship them inlined in the PyPy source tree.
PyPy employs an open development process. You are invited to join our