feat: Implement transpiler ASTx to Python String via ASTx to Python AST#284
Closed
nagajaideep wants to merge 3 commits intoarxlang:mainfrom
nagajaideep:main
Closed
feat: Implement transpiler ASTx to Python String via ASTx to Python AST#284nagajaideep wants to merge 3 commits intoarxlang:mainfrom nagajaideep:main
nagajaideep wants to merge 3 commits intoarxlang:mainfrom
nagajaideep:main
Conversation
xmnlab
reviewed
Aug 17, 2025
Contributor
xmnlab
left a comment
There was a problem hiding this comment.
thanks for working on that @nagajaideep
in general looks pretty good .. I will take a bit more time to review it again soon
xmnlab
reviewed
Aug 19, 2025
xmnlab
reviewed
Aug 19, 2025
| @@ -1,1845 +0,0 @@ | |||
| """Test Python Transpiler.""" | |||
Contributor
There was a problem hiding this comment.
@nagajaideep you shouldn't remove this file .. because this is the way we test the transpiler .. probably you should update the tests .. but it should be something similart:
transpile an astx node, and check the string if that makes sense
Contributor
|
@nagajaideep could you please rebase your branch on top of the upstream main? |
Contributor
Author
|
Yes @xmnlab will rebase it and include the test_python_string.py file in the upcoming commit and fix those errors and give you an update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the
python_to_ast.pymodule to align with the mentor's architecture for AST-based transpilation.It removes circular dependencies, introduces a new module for string generation, and ensures a clean separation of concerns between AST conversion and string generation.
Changes Made:
Fixed Circular Dependency in
python_to_ast.py:astx_transpilers.python_stringin the_convert_using_unparsemethod.ast.Constantorast.Namenodes.Created New
python_string_new.py:ASTxPythonASTTranspilerfrompython_to_ast.pyinternally.ASTxPythonASTTranspiler→ Python AST →ast.unparse()→ String.Added
test_new_implementation.py:How to test these changes
For Direct AST Output (ASTx → Python AST):
For String Output (ASTx → Python Source Code):
Run Tests:
Pull Request checklists
Note:
proposed in this PR, in both image and ASCII formats. For more
information, check this Google Colab notebook:
https://colab.research.google.com/drive/1xXwHmOMkJKFSmhRvn4WYfSAsdDzMnawf?usp=sharing
This PR is a:
About this PR:
Author's checklist:
complexity.
Additional information
Benefits of the Refactor:
python_to_ast.pyhandles ASTx → Python AST conversion.ast.unparse()for consistent string generation.