New Python implementation

Mr Flibble flibble at i42.REMOVETHISBIT.co.uk
Thu Feb 11 12:45:25 EST 2021


On 11/02/2021 15:13, Chris Angelico wrote:
> 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,

Yes.

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

No. The neos universal compiler itself is language agnostic: a pre-requisite for the requirement to be able to compile any programming language.

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

You are timing the arithmetic library rather than the interpreter.

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

neoscript is the neos reference language (i.e. not an intermediate language) and will be unrelated to the Python implementation.

/Flibble

-- 
😎


More information about the Python-list mailing list