We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for transpiler from ASTx to Python built-in AST.
Example for how to use Python ast:
import ast # Create an if-else structure programmatically if_stmt = ast.If( test=ast.Compare( left=ast.Name(id="x", ctx=ast.Load()), # x ops=[ast.Gt()], # > comparators=[ast.Constant(value=10)], # 10 ), body=[ast.Expr( value=ast.Call( func=ast.Name(id="print", ctx=ast.Load()), args=[ast.Constant(value="x is greater than 10")], keywords=[] ) )], orelse=[ast.Expr( value=ast.Call( func=ast.Name(id="print", ctx=ast.Load()), args=[ast.Constant(value="x is 10 or less")], keywords=[] ) )] ) # Wrap in a Module node module = ast.Module(body=[if_stmt], type_ignores=[]) # Convert to source code new_code = ast.unparse(module) print(new_code)
The current transpiler from ASTx to Python Source can be use as a reference: https://github.com/arxlang/astx/blob/main/src/astx/tools/transpilers/python.py
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Summary
Add support for transpiler from ASTx to Python built-in AST.
Example for how to use Python ast:
The current transpiler from ASTx to Python Source can be use as a reference: https://github.com/arxlang/astx/blob/main/src/astx/tools/transpilers/python.py
Additional Information
Code of Conduct
The text was updated successfully, but these errors were encountered: