Open mturquette opened 8 years ago
I have already implemented a Python 2 interpreter in my head, so yes.
It's fairly slow, naturally, but I've identified a number of runtime optimizations. For instance, thanks to my advanced caching layer you can yell "return-slash-true" at me and because that function is idempotent I can respond "FALSE!" without even evaluating the input.
Please spin the interpreter-of-the-mind project out into a separate repo. We'll reference it with a git submodule.
Also, I think that skipping evaluations is an optimization that we should explore further. In particular, for any functions that pass in arguments we can ignore those arguments and immediately return a constant value. Huge performance increase.
However this needs to be a pure virtual implementation as well, so the constants won't actually be constants, but instead whatever you think of off the top of your head since this is running in your interpreter-of-the-mind.
Ideally there would be no real hardware involved at all. Everything would be pure virtual.