-
Notifications
You must be signed in to change notification settings - Fork 27
Project Ideas
Ivan Ogasawara edited this page Feb 11, 2025
·
4 revisions
- Documentation: https://astx.arxlang.org
- License: BSD 3 Clause
- Code of Conduct: Code of Conduct
This project aims to develop a transpiler from ASTx to Python's built-in AST, allowing seamless conversion of ASTx representations into Python's ast module structures. This feature will enable Python code generation from ASTx, making it easier to integrate ASTx with Python-based tools, static analysis, and compilers. The implementation should follow ASTx's existing transpiler structure, leveraging the current ASTx to Python Source Transpiler as a reference.
- ASTx provides a transpiler from ASTx to Python source code.
- There is no direct conversion from ASTx to Python's
astmodule. - Python's
astmodule allows programmatic manipulation of Python code. - A structured approach is required to map ASTx node types to their Python AST equivalents.
- Implement a node visitor pattern to translate ASTx nodes into Python AST nodes.
- Define mappings for:
- Expressions (BinaryOp, FunctionCall, Literals, etc.)
- Statements (IfStmt, WhileStmt, FunctionDef, etc.)
- Declarations (VariableDeclaration, FunctionPrototype, etc.)
- Ensure correct handling of variable scoping and function definitions.
- Integrate the new transpiler into
astx.tools.transpilers.python.py. - Write unit tests to validate conversions between ASTx and Python AST.
- Provide examples and documentation for users.
- A working transpiler from ASTx to Python AST.
- A test suite ensuring accurate translation.
- Documentation explaining how to use the transpiler.
- Examples showcasing ASTx → Python AST → Python code execution.
-
Prerequisites:
- Understanding of Python's
astmodule (basic level). - Familiarity with ASTx and its structure (basic level).
- Experience in compiler design, transpilers, or code generation (basic level).
- Proficiency in Python and visitor patterns (basic level).
- Understanding of Python's
-
Duration: 350 hours
-
Complexity: Medium
-
Potential Mentor(s): Ivan Ogasawara, Ana Krelling, Devansh Parmar
-
Python
astModule: Python Docs - ASTx Source Code: GitHub - ASTx
- Existing Python Transpiler: ASTx Python Transpiler
- Python AST Manipulation Example: Python AST Walkthrough