one liner: eval(str)
Went into comments looking for this exact comment. Wasn't disappointed
A Python Interpreter Written in Python
41–50 of 57 posts
Re: A Python Interpreter Written in Python
#42Perl is transformed into an AST. Then that is decorated into an opcode tree. The thing runs code nearly as fast as C in many instances, once the startup has completed and the code is actually running.
Re: A Python Interpreter Written in Python
#43Earlier quoted context omitted.
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…
Interpreters don't translate bytecode to native instructions.
Re: A Python Interpreter Written in Python
#44Re: A Python Interpreter Written in Python
#45Earlier quoted context omitted.
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
Re: A Python Interpreter Written in Python
#46Re: A Python Interpreter Written in Python
#47Re: A Python Interpreter Written in Python
#48Earlier quoted context omitted.
They do now https://github.com/bytecodealliance/weval
That's a partial evaluator, not an interpreter, and it converts an interpreter into compiler, which are different things.
> 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...
Re: A Python Interpreter Written in Python
#49Earlier quoted context omitted.
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...