May 03

On Thursday, 25 April 2024 at 16:57:53 UTC, mw wrote:

>

On Wednesday, 24 April 2024 at 22:07:41 UTC, Chris Piker wrote:

>

Python-AST to D source converter may already exist?

https://github.com/joortcom/eiffel_rename/tree/main/yi

A rudimentary converter from (extended) Python to D. Maybe you can use it as a starting point.

Thanks for the suggestions. I put the question aside for a bit, but yesterday ran across a python transpiler here:

https://github.com/py2many/py2many

It already has support for C++, Go and others. Since I have mountains of python code created over many years, maybe it would be worth contributing to this project out of self interest.

Can you take a look at py2many and see what you think about it? Getting D on the support list might be good.

May 03

On Friday, 3 May 2024 at 17:38:10 UTC, Chris Piker wrote:

>

On Thursday, 25 April 2024 at 16:57:53 UTC, mw wrote:

>

On Wednesday, 24 April 2024 at 22:07:41 UTC, Chris Piker wrote:

>

Python-AST to D source converter may already exist?

https://github.com/joortcom/eiffel_rename/tree/main/yi

A rudimentary converter from (extended) Python to D. Maybe you can use it as a starting point.

Thanks for the suggestions. I put the question aside for a bit, but yesterday ran across a python transpiler here:

https://github.com/py2many/py2many

It already has support for C++, Go and others. Since I have mountains of python code created over many years, maybe it would be worth contributing to this project out of self interest.

Can you take a look at py2many and see what you think about it? Getting D on the support list might be good.

(Haven't checked its own implementation and output code quality.)

But it says has output for Kotlin, Dart, these two languages are similar to D syntactically, so will be a good start.

May 23

On Friday, 3 May 2024 at 17:53:41 UTC, mw wrote:

>

On Friday, 3 May 2024 at 17:38:10 UTC, Chris Piker wrote:

>

On Thursday, 25 April 2024 at 16:57:53 UTC, mw wrote:

>

[...]

Thanks for the suggestions. I put the question aside for a bit, but yesterday ran across a python transpiler here:

https://github.com/py2many/py2many

It already has support for C++, Go and others. Since I have mountains of python code created over many years, maybe it would be worth contributing to this project out of self interest.

Can you take a look at py2many and see what you think about it? Getting D on the support list might be good.

(Haven't checked its own implementation and output code quality.)

But it says has output for Kotlin, Dart, these two languages are similar to D syntactically, so will be a good start.

I took another quick look of the project, it uses the Python builtin ast module as parser, and visitor design pattern to implement the transcompiler, so I think it's of decent quality.

HTH.

July 12

On Friday, 3 May 2024 at 17:38:10 UTC, Chris Piker wrote:

>

On Thursday, 25 April 2024 at 16:57:53 UTC, mw wrote:

>

On Wednesday, 24 April 2024 at 22:07:41 UTC, Chris Piker wrote:

>

Python-AST to D source converter may already exist?

https://github.com/joortcom/eiffel_rename/tree/main/yi

A rudimentary converter from (extended) Python to D. Maybe you can use it as a starting point.

Thanks for the suggestions. I put the question aside for a bit, but yesterday ran across a python transpiler here:

https://github.com/py2many/py2many

It already has support for C++, Go and others. Since I have mountains of python code created over many years, maybe it would be worth contributing to this project out of self interest.

Can you take a look at py2many and see what you think about it? Getting D on the support list might be good.

Hi,

I have made basic py2many.pyd work at language/syntax level in my dlang fork:

https://github.com/mw66/py2many/tree/dlang

The following examples works now:

https://github.com/mw66/py2many/tree/dlang/tests/expected

py2many/ 13:56:23$ ls ./tests/expected/*.d
./tests/expected/bubble_sort.d
./tests/expected/cls.d
./tests/expected/fib.d
./tests/expected/import_tests.d
./tests/expected/classes.d
./tests/expected/dict.d
./tests/expected/hello_world.d
./tests/expected/nested_dict.d

I haven't created PR to be merged into the main branch, since it's better to pass all the tests.

All the remaining work is to make Python's specific feature (e.g. async), library (e.g. complex number, NamedTemporaryFile) work in D. There are many things need to be done, if you have time, you can pick up from my fork, and work from there. (E.g. you can create PR to my branch, and when everything is ready, we submit to the main py2many all together).

HTH.

July 12

On Friday, 12 July 2024 at 18:07:50 UTC, mw wrote:

>

On Friday, 3 May 2024 at 17:38:10 UTC, Chris Piker wrote:
...

>

Hi,

I have made basic py2many.pyd work at language/syntax level in my dlang fork:

https://github.com/mw66/py2many/tree/dlang

The following examples works now:

https://github.com/mw66/py2many/tree/dlang/tests/expected

py2many/ 13:56:23$ ls ./tests/expected/*.d
./tests/expected/bubble_sort.d
./tests/expected/cls.d
./tests/expected/fib.d
./tests/expected/import_tests.d
./tests/expected/classes.d
./tests/expected/dict.d
./tests/expected/hello_world.d
./tests/expected/nested_dict.d

I haven't created PR to be merged into the main branch, since it's better to pass all the tests.

All the remaining work is to make Python's specific feature (e.g. async), library (e.g. complex number, NamedTemporaryFile) work in D. There are many things need to be done, if you have time, you can pick up from my fork, and work from there. (E.g. you can create PR to my branch, and when everything is ready, we submit to the main py2many all together).

HTH.

Please use this Makefile for local setup and run tests:

https://github.com/mw66/py2many/blob/dlang/Makefile

July 12

On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote:

>

I can just call my old C code from D, but the old Python is another story.

Thanks for any advice you may have,

You could also try some AI solution

July 15

On Friday, 12 July 2024 at 18:07:50 UTC, mw wrote:

>

On Friday, 3 May 2024 at 17:38:10 UTC, Chris Piker wrote:

>

On Thursday, 25 April 2024 at 16:57:53 UTC, mw wrote:

>

On Wednesday, 24 April 2024 at 22:07:41 UTC, Chris Piker wrote:

>

Python-AST to D source converter may already exist?

https://github.com/joortcom/eiffel_rename/tree/main/yi

A rudimentary converter from (extended) Python to D. Maybe you can use it as a starting point.

Thanks for the suggestions. I put the question aside for a bit, but yesterday ran across a python transpiler here:

https://github.com/py2many/py2many

It already has support for C++, Go and others. Since I have mountains of python code created over many years, maybe it would be worth contributing to this project out of self interest.

Can you take a look at py2many and see what you think about it? Getting D on the support list might be good.

Hi,

I have made basic py2many.pyd work at language/syntax level in my dlang fork:

https://github.com/mw66/py2many/tree/dlang

The following examples works now:

https://github.com/mw66/py2many/tree/dlang/tests/expected

py2many/ 13:56:23$ ls ./tests/expected/*.d
./tests/expected/bubble_sort.d
./tests/expected/cls.d
./tests/expected/fib.d
./tests/expected/import_tests.d
./tests/expected/classes.d
./tests/expected/dict.d
./tests/expected/hello_world.d
./tests/expected/nested_dict.d

I haven't created PR to be merged into the main branch, since it's better to pass all the tests.

All the remaining work is to make Python's specific feature (e.g. async), library (e.g. complex number, NamedTemporaryFile) work in D. There are many things need to be done, if you have time, you can pick up from my fork, and work from there. (E.g. you can create PR to my branch, and when everything is ready, we submit to the main py2many all together).

HTH.

FYI, now merged into the main branch:

https://github.com/py2many/py2many/tree/main/pyd

July 17

On Monday, 15 July 2024 at 19:40:01 UTC, mw wrote:

>

On Friday, 12 July 2024 at 18:07:50 UTC, mw wrote:

>

[...]

FYI, now merged into the main branch:

https://github.com/py2many/py2many/tree/main/pyd

This is great and certainly deserves an own discussion contribution in General.

Did you try to convert any of the pystone programs?
This would allow for benchmarking comparisons with e.g. nuitka or other approaches of compiled Python.

August 08

On Friday, 12 July 2024 at 18:07:50 UTC, mw wrote:

>

I have made basic py2many.pyd work at language/syntax level in my dlang fork:

https://github.com/mw66/py2many/tree/dlang

The following examples works now:

https://github.com/mw66/py2many/tree/dlang/tests/expected

py2many/ 13:56:23$ ls ./tests/expected/*.d
./tests/expected/bubble_sort.d
...

Outstanding! Thanks for the work! (Apologies for my slow response. I've been back on a C project for a while and didn't notice your posts.)

I will definitely make use of this when D is back atop the stack, should be about three weeks from now. One of my core support services still has about 20% python (the rest is D). Will be nice to convert the remaining 20%.

August 08

On Thursday, 8 August 2024 at 20:20:11 UTC, Chris Piker wrote:

>

(the rest is D).

D in space when? :)