On Wednesday, 24 April 2024 at 20:13:26 UTC, Lance Bachmeier
wrote:
I haven't used Python much in recent years, but my recollection
is that Python 2 had an ast module that would spit out the ast
for you.
Thanks for the pointer! So I ran one of my modules through and
generated an AST, and get results similar to:
```
Module(
body=[
Import(
names=[
alias(name='sys')]),
FunctionDef(
name='pout',
args=arguments(
posonlyargs=[],
args=[
arg(arg='item')],
kwonlyargs=[],
kw_defaults=[],
defaults=[]),
body=[
```
etc.
I presume I'll now need to write something that parses this into
D source (maybe with the assistance of a module provided above).
Before I do that, is this syntax general enough that a Python-AST
to D source converter may already exist? Obvious searches in
google and the D package index didn't turn up anything.
I have no background at all in working with ASTs, in fact my
formal education is not even in CS, so I'm way outside my
wheelhouse at this point.