Live data from Hacker News

A Python Interpreter Written in Python

aosabook.org

41–50 of 57 posts

Re: A Python Interpreter Written in Python

#42
The article contrasts Python to Perl, saying Perl is purely interpreted while Python has compilation. This is factually incorrect.

Perl 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

#43

Earlier 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.

They do now https://github.com/bytecodealliance/weval

Re: A Python Interpreter Written in Python

#44

Earlier quoted context omitted.

Are you a bot? All your recent comments point out a thing in an article and contain LLM-isms.

you asking a bot if it is a bot? :)

haha no im not a bot, but starting to realise i sound like one. need to be less cynical.

Re: A Python Interpreter Written in Python

#45

Earlier 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

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.

Re: A Python Interpreter Written in Python

#46
post #43

Earlier quoted context omitted.

Interpreters don't translate bytecode to native instructions.

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.

Re: A Python Interpreter Written in Python

#48
post #43

Earlier 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.

> 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...

Re: A Python Interpreter Written in Python

#49
post #48

Earlier 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...

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.

Re: A Python Interpreter Written in Python

#50
post #7
post #6

Earlier quoted context omitted.

PyPy is python implemented in python. It is fast.

PyPy is python implemented in RPython, which is technically a python subset. It's so restricted it might as well be a different language though.

PyRPy is just less catchy sounding
Post reply on HN