DTStack / dt-python-parser

Python Parsers for BigData, built with antlr4.
MIT License
25 stars 6 forks source link

Python Code Generator and Tree-Rewrite Engine for Python Parser #15

Open evonox opened 2 years ago

evonox commented 2 years ago

Hi all, in my Python IDE I need emulate synchrounous Python code in the browser. The reason for this is that we cannot teach young students asynchronous programming paradigma using async and await keywords. The path I want to do this is using dt-python-parser, then to use a grammar-based tree-rewrite engine for AST to rewrite synchronous code to asynchronous and finally use a Python synthetizer to generate Python Code again.

1) Before I will implement Python Code Generator and Python Tree-Rewrite Engine I want to ask if anyone is not already working on this issue.

2) My second question is if you want this contribution to make part of dt-python-parser? It would be quite fine to have it in one library.

Thanks very much for answer.

wewoor commented 2 years ago

cannot teach young students asynchronous programming paradigma using async and await keywords

@evonox Sorry, I can't understand that~ I think that implementing Python Code Generator and Python Tree-Rewrite Engine are big and complex work. we know that Python is a very mature language, I think you can find out some implements in the community.

The background of dt-python-parser is that supporting our frontend project, which only needs syntax check, code formatting, and so on simple features. so I think to make it be part of dt-python-parser is not suitable.

joshi1983 commented 1 year ago

@evonox is your rewrite engine available publicly anywhere yet? You asked a little over a year ago. I do a little Python parse tree restructuring and rewriting in my use of DT Python Parser but my rewrite code is heavily coupled to the rest of my application and I won't be willing to releasing the code very openly any time soon. I'm up for sharing concepts and brainstorming ideas, if you want to learn a bit from what I've done, though. Want to share an email address or another way to get in touch?

evonox commented 1 year ago

@joshi1983 To be honest, my idea for Python Rewrite engine remained only idea. But if there would be an interest, it might be a great tool to create in an open-source way. My initial idea is to take inspiration in BabelJS and create it in the similar architecture. What do you think?