user3318845
user3318845

Reputation: 331

Can PyPy run everywhere Python can?

I heard that PyPy has its own JIT compiler. I'm thinking of implementing a language using PyPy's translator script to convert the RPython to C. So I was wondering, where does PyPy run? Can it run everywhere Python does? Or can it only run on specific CPUs?

Upvotes: 2

Views: 437

Answers (2)

Chris Wesseling
Chris Wesseling

Reputation: 6368

Yes, you can run PyPy everywhere where you can run Python:

PyPy is implemented in RPython.

The R stands for Restricted. RPython is a subset of Python. So any Python interpreter implementation should be able to interpret and run RPython code. So everywhere where you have an interpreter that can run Python code, you can run PyPy.

But that would be dog slow. You would use a Python interpreter (CPython, Jython, IronPython) to run another Python interpreter (PyPy) to run your Python code.

That is why when you build PyPy from source you translate to C code and compile that.

Watch Dave Beazley's Keynote of PyCon US 2012 to have an entertaining introduction of what really happens.

Upvotes: 0

Tobias
Tobias

Reputation: 3110

Reading the RPython source code, it seems that currently x86 and ARM (both 32/64 Bit) are supported for the jit.

Without a jit, it should be every platform that sports an ANSI C compiler, or better, a GCC compatible one. Pypy is translated to plain (but not easily to read for humans) C.

Upvotes: 4

Related Questions