<p>The <a href="https://rpython.readthedocs.io/en/latest/" rel="nofollow noreferrer">RPython</a> toolchain translates interpreters to JIT compilers. The interpreter may be written in any style; the corresponding JIT compiler is defined by annotations on the main loops of the interpreter.</p>
<p>In practice, there are only two styles of interpreter used with RPython. One is AST walking, which is also the only style supported by the Truffle ecosystem. The other style is bytecode evaluation, as traditionally used by Python implementations like PyPy.</p>
<p>Which other styles of interpreter are supported by RPython? That seems like too open of a question, so I want to ask something narrower: which other styles are <em>not</em> well-supported?</p>

<just-in-time>
What styles of interpreter are not well-supported by RPython?
CC BY-SA 4.0
2023-09-19T16:48:50.307Z
This is well-known folklore in the RPython ecosystem, but I'm hoping for answers from those who are less biased than me.
Corbin
CC BY-SA 4.0
2023-09-20T09:50:34.953Z
What do you mean by interpreter? By the Church-Turing thesis, you should be able to convert any kind of interpreter into any other kind, no?
Martin Berger
CC BY-SA 4.0
2023-09-20T15:39:49.123Z
@MartinBerger: The RPython toolchain can only generate JIT compilers which have a central loop of some sort; the loop is translated into four interpreters which interleave mutation, tracing, and deoptimization for each iteration of the loop. RPython lore is that the only option is bytecode evaluation, but AST-walking is also known to work well. This question is about interpreter styles which are known to *not* work well.
Corbin
CC BY-SA 4.0
2023-09-20T18:58:32.787Z
Could you give a concrete example of a style of interpreter that you are not sure about suits RPython?
Martin Berger
CC BY-SA 4.0
2023-09-21T02:06:32.550Z
@MartinBerger: Sure! This would also be a good start to an answer. Some [FORTH-style threaded interpreters](https://en.wikipedia.org/wiki/Threaded_code) are not suitable, because they don't loop; instead, they jump forward forever. Similarly, [Cheney on the MTA](https://plover.com/~mjd/misc/hbaker-archive/CheneyMTA.html) (Haskell, CHICKEN Scheme) isn't available, which is a real issue for those languages due to their concurrency primitives and evaluation order. [Graph reduction](https://en.wikipedia.org/wiki/Graph_reduction) can be done, in contrast.
Corbin
CC BY-SA 4.0
2024-01-27T04:42:02.077Z
I wonder if a CPS interpreter would perform well on PyPy
tekknolagi
# What styles of interpreter are not well-supported by RPython?
Posted by: username_0 on 2023-09-19
The [RPython](https://rpython.readthedocs.io/en/latest/) toolchain translates interpreters to JIT compilers. The interpreter may be written in any style; the corresponding JIT compiler is defined by annotations on the main loops of the interpreter.

In practice, there are only two styles of interpreter used with RPython. One is AST walking, which is also the only style supported by the Truffle ecosystem. The other style is bytecode evaluation, as traditionally used by Python implementations like PyPy.

Which other styles of interpreter are supported by RPython? That seems like too open of a question, so I want to ask something narrower: which other styles are *not* well-supported?
**Tags:** just-in-time
> **Comments:**
> **username_0**: This is well-known folklore in the RPython ecosystem, but I'm hoping for answers from those who are less biased than me.  
> **username_1**: What do you mean by interpreter? By the Church-Turing thesis, you should be able to convert any kind of interpreter into any other kind, no?  
> **username_0**: @MartinBerger: The RPython toolchain can only generate JIT compilers which have a central loop of some sort; the loop is translated into four interpreters which interleave mutation, tracing, and deoptimization for each iteration of the loop. RPython lore is that the only option is bytecode evaluation, but AST-walking is also known to work well. This question is about interpreter styles which are known to *not* work well.  
> **username_1**: Could you give a concrete example of a style of interpreter that you are not sure about suits RPython?  
> **username_0**: @MartinBerger: Sure! This would also be a good start to an answer. Some [FORTH-style threaded interpreters](https://en.wikipedia.org/wiki/Threaded_code) are not suitable, because they don't loop; instead, they jump forward forever. Similarly, [Cheney on the MTA](https://plover.com/~mjd/misc/hbaker-archive/CheneyMTA.html) (Haskell, CHICKEN Scheme) isn't available, which is a real issue for those languages due to their concurrency primitives and evaluation order. [Graph reduction](https://en.wikipedia.org/wiki/Graph_reduction) can be done, in contrast.  
> **username_2**: I wonder if a CPS interpreter would perform well on PyPy  
---
## 0 answers
