3 ms·
Interpreters don't translate bytecode to native instructions.
by direwolf20 5mo ago
Interpreters don't translate bytecode to native instructions.
- SJC_Hacker 5mo agoThe 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 https://doc.pypy.org/en/latest/interpreter.html
- ghusbands 5mo agoThis 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.
- genxy 5mo agoThey do now https://github.com/bytecodealliance/weval https://github.com/bytecodealliance/weval
- ghusbands 5mo agoThat's a partial evaluator, not an interpreter, and it converts an interpreter into compiler, which are different things.
- genxy 5mo ago> 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/retrofitting_jit_compilers_into_c_interpreters/ https://old.reddit.com/r/Compilers/comments/1sm90x5/retrofit...
- ghusbands 5mo agoYes, 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.
- genxy 5mo agoThe 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.
- direwolf20 5mo agoIf you turn milk into cheese it isn't milk any more, and it doesn't prove that milk is a yellow solid.
- genxy 5mo agoWe lost the plot here. What are your goals, to let everyone know that interpreters, definitionally don't generate code? This isn't debate club. I dropped a cool link that shows we have a machine that turns interpreters into compilers. I am talking about the machine. You are talking about the definition. We aren't talking about the same thing.
- ghusbands 5mo agoPartly, it's simply that words matter. An interpreter is not a compiler, even if partial evaluators and Futamura transforms are very cool. Posting about them in a context that isn't a confusion about what interpreters are may have been more fruitful.