Hacker News new | ask | show | jobs
by SJC_Hacker 58 days ago
This is the case only if the new interpreter does not simply include the layer that the old interpreter has for translating bytecode to native instructions. Once you have that, you can simply bootstrap any new interpreters from previous ones. Even in the case of supporting new architectures, you can still work at the Python level to produce the necessary binary, although the initial build would have to be done on an already supported architechture.
1 comments

Interpreters don't translate bytecode to native instructions.
The usual understanding of "interpreter" in a CS context is program that executes source code directly without a compilation step. However the binary that translates an intermediate bytecode to native machine code is at least sometimes called a "bytecode interpreter".

https://doc.pypy.org/en/latest/interpreter.html

This is still incorrect. A bytecode interpreter, as its name indicates, interprets a bytecode. Typically, compiling a bytecode to native machine code is the work of a JIT compiler.
That's a partial evaluator, not an interpreter, and it converts an interpreter into compiler, which are different things.
> Interpreters don't translate bytecode to native instructions.

> That's a partial evaluator, not an interpreter, and it converts an interpreter into compiler, which are different things.

https://old.reddit.com/r/Compilers/comments/1sm90x5/retrofit...

Yes, that's another great example of the same kind of thing - creating a JIT from an interpreter. It remains true that interpreters do not directly generate machine code.
The author of weval is the top comment.

Reading the comments and understanding that transitively, weval turns interpreters into compilers, allowing interpreters to generate machine code.