> Byterun is a Python interpreter written in Python. This may strike you as odd, but it's no more odd than writing a C compiler in C. I'm not so sure. The difference between a self-hosted compiler and a circular interpreter is that the compiler has a binary artifact that you can store. With an interpreter, you still need some binary to run your interpreter, which will probably be CPython, making the new interpreter r…
A Python Interpreter Written in Python
21–30 of 57 posts
Re: A Python Interpreter Written in Python
#22Earlier quoted context omitted.
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.
> technically a python subset So it can just run under CPython? If so, then that isn't too misleading.
Re: A Python Interpreter Written in Python
#23Re: A Python Interpreter Written in Python
#24> Byterun is a Python interpreter written in Python. This may strike you as odd, but it's no more odd than writing a C compiler in C. I'm not so sure. The difference between a self-hosted compiler and a circular interpreter is that the compiler has a binary artifact that you can store. With an interpreter, you still need some binary to run your interpreter, which will probably be CPython, making the new interpreter r…
Re: A Python Interpreter Written in Python
#25aka A Metacircular Interpreter
Re: A Python Interpreter Written in Python
#26Earlier quoted context omitted.
> And, in some ways, PyPy What do you mean by that? I'm not familiar with PyPy
PyPy is python implemented in python. It is fast.
Re: A Python Interpreter Written in Python
#27cf: https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_Ref...
Re: A Python Interpreter Written in Python
#28eval(str)
Re: A Python Interpreter Written in Python
#29the article glosses over something worth pausing on: the `getattr` trick for dispatching instructions (replacing the big if-elif chain) is actaully a really elegant pattern that shows up in a lot of real interpreters and command dispatchers, not just toy ones -- worth studying that bit specifically if you're building anything with extensible command sets.
Re: A Python Interpreter Written in Python
#30the article glosses over something worth pausing on: the `getattr` trick for dispatching instructions (replacing the big if-elif chain) is actaully a really elegant pattern that shows up in a lot of real interpreters and command dispatchers, not just toy ones -- worth studying that bit specifically if you're building anything with extensible command sets.
Are you a bot? All your recent comments point out a thing in an article and contain LLM-isms.