Recommendations on porting Python to D

max haughton maxhaton at gmail.com
Fri Apr 26 00:14:43 UTC 2024


On Wednesday, 24 April 2024 at 19:50:45 UTC, Chris Piker wrote:
> Hi D
>
> I have a somewhat extensive CGI based web service written in 
> Python and I'd like to port it to D.  I can do this manually of 
> course, and maybe that's the best way, but for a rough start, 
> is anyone aware of any tools that generate an abstract syntax 
> tree which could then be converted to somewhat equivalent D 
> code?  This might give me a jump-start on the manual conversion 
> process.  Then later I can work on removing the CGI dependency.
>
> I'm aware that this wouldn't work in general due to all the 
> third party modules typically used in python, but most of this 
> code is self contained Python2 and doesn't depend on many 
> imports.
>
> I can just call my old C code from D, but the old Python is 
> another story.
>
> Thanks for any advice you may have,

A strategy roughly along the lines of:

Test what you can, then port the tests, then just let chatgpt 
have at it can go further than one might reasonably expect (I 
have used chatgpt to convert to and from languages that don't 
even exist in public and it can basically get the gist of most 
things).

Treat it interactively rather than like a CLI tool, it must be 
said.




More information about the Digitalmars-d-learn mailing list