New Python implementation

Chris Angelico rosuav at gmail.com
Thu Feb 11 10:13:50 EST 2021


On Thu, Feb 11, 2021 at 11:36 PM Mr Flibble
<flibble at i42.removethisbit.co.uk> wrote:
>
>
> Hi!
>
> I am starting work on creating a new Python implementation from scratch using "neos" my universal compiler that can compile any programming language.

Is it your intention to support all of Python's syntax and semantics,
or is this an unrelated language with mandatory strict type tags and a
severely restricted set of data types? For instance, can your neos
compile this code?

def power():
    return (2**3**4**2) % 1000000000

from time import time
start = time()
print(power())
time = time() - start
print("Took %s seconds" % time)

On my system, I get this from CPython 3.10:
176561152
Took 0.1589798927307129 seconds

And this from PyPy:
176561152
Took 0.0233387947083 seconds

> I envision this implementation to be significantly faster than the currently extant Python implementations (which isn't a stretch given how poorly they perform).

Riiiiiight, yep, all existing Python implementations are terribly
slow. Go ahead then; run the code above, show me a better time, and of
course compare to what a recent off-the-shelf CPython can do on the
same hardware. Then see how PyPy performs at the same job.

> Sample neos session (parsing a fibonacci program, neoscript rather than Python in this case):

Is neoscript an intermediate language like RPython, used only to
implement the compiler, or are you actually transforming Python code
into neoscript?

ChrisA


More information about the Python-list mailing list