Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Options beyond RPython for writing interpreters w/ JITs?

Tags:

People also ask

Why is PyPy so fast?

PyPy often runs faster than CPython because PyPy uses a just-in-time compiler. Most Python code runs well on PyPy except for code that depends on CPython extensions, which either does not work or incurs some overhead when run in PyPy.

Is PyPy written in Python?

Python and PyPy. The Python language specification is used in a number of implementations such as CPython (written in C), Jython (written in Java), IronPython (written for . NET), and PyPy (written in Python).

Does PyPy support Python 3?

On a suite of benchmarks, it's currently over 5 times faster than CPython. PyPy supports Python 2.7. PyPy3, released in beta, targets Python 3.


I'm really interested in the PyPy project, but for the 1st (but less well-known) of its purposes listed below:

  • A set of tools for implementing interpreters for interpreted languages
  • An implementation of Python using this toolchain

In the following blog post, http://morepypy.blogspot.com/2011/04/tutorial-writing-interpreter-with-pypy.html, and http://morepypy.blogspot.com/2011/04/tutorial-part-2-adding-jit.html there's a detailed tutorial on how to implement a brainfork interpreter with RPython, and add a JIT.

However I've read elsewhere that RPython can be troublesome to work with--syntax created for dynamic typing suddenly restricted to inferred static typing leads to hard-to-understand compile errors.

So my question is, are there any other projects that would allow you to write a brainfudge interpreter/JIT like in the tutorial above? Or is PyPy the only option for doing so as succinctly?

(Aside): If one exists, what's the point of RPython in general? Is it just to show that a subset Python can be made type-safe, and Python implemented in that subset? Would it have made more sense just to do "PyPy" in an existing interpreter-creation tool?