Skip to content

Feature Request: Add Multi-language Parser Support to ABCoder #64

@welkeyever

Description

@welkeyever

1. Summary

This proposal outlines the plan to extend abcoder to support multiple programming languages. Currently, abcoder's capabilities are limited to Go/Rust/C/Pyhon, which restricts its use in polyglot environments. By adding multi-language support, we can significantly broaden the tool's applicability and enhance its utility for a wider range of projects.

2. Motivation

The primary motivation for this feature is to make abcoder a more versatile and powerful tool for code analysis and transformation. Many modern software projects are built using multiple languages, and a tool that can seamlessly handle this diversity is essential. Supporting multiple languages will enable developers to:

  • Analyze and understand complex, multi-language codebases.
  • Perform consistent code quality checks and enforce standards across different languages.
  • Automate refactoring and code generation tasks in polyglot projects.
  • Facilitate cross-language interoperability and integration.

3. Detailed Design

To achieve multi-language support, we will implement a flexible and extensible parser architecture. The key components of this design are:

  • Pluggable Parser Interface: We will define a standardized interface for language parsers. This will allow new parsers to be integrated into abcoder as plugins, without requiring changes to the core system. Each parser will be responsible for transforming source code into a Universal Abstract Syntax Tree (UniAST).

  • Universal Abstract Syntax Tree (UniAST): The UniAST will serve as a common, language-agnostic representation of the code's structure. We will need to ensure that the UniAST is expressive enough to capture the semantics of all supported languages. This may involve extending the existing UniAST definition to accommodate new language constructs.

  • Language-Specific Parsers: We will develop individual parsers for each supported language. These parsers will implement the pluggable parser interface and handle the specifics of parsing their respective languages. The initial set of languages to be supported will be determined based on community demand and strategic importance.

4. In-Progress Languages

Language Status Assignee
Go Done @AsterDY
Rust Done @AsterDY
C Done @Hoblovski
Python In Progress @Hoblovski
Java Done @Huabuxiu
TypeScript/JavaScript Done @angrychow
C++ Not Started

5. Reference

Some related docs can be found here: https://github.com/cloudwego/abcoder/tree/main/docs

We welcome feedback and suggestions from the community on these and any other aspects of this proposal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestThis is a feature request issue. Implementations of feature requests use `C-enhancement` instead.E-help-wantedStuff where we want help.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions