dlang / project-ideas

Collection of impactful projects in the D ecosystem
36 stars 12 forks source link

Replace use of libdparse with dmd as a library in dfix #104

Open RazvanN7 opened 1 year ago

RazvanN7 commented 1 year ago

Description

dfix is a tool to automatically upgrade code to new features. It uses libdparse - a third party implementation of a D lexer+parser - to obtain an AST which it then uses to generate the fixed code. Since libdparse has a different implementation from the reference D frontend, every time a parser change occurs, libdparse and (likely) its dependencies need to be updated.

The project aims at using the dmd-as-a-library package, which shares its implementation with the reference D compiler, to substitute the use of libdparse in dfix.

What are rough milestones of this project?

  1. Create a fork of dfix and set up a testing pipeline.
  2. Use dmd-as-a-library to obtain the AST.
  3. Rewrite the existing visitors to use the generated AST
  4. Write more potential fixes for existing deprecations.
  5. Integrate the fork in the original dfix repo.

How does this project help the D community?

Ideally, every deprecation or language change should be accompanied by a tool that automatically updates the wrong code to the correct code. Having dfix use the compiler as a library will make it easier for compiler devs to implement the fixes and thus improving the user experience when deprecations/language changes occur.

Recommended skills

Knowledgeable with AST, parsers, compilers. Prior experience with D/C/C++/Java OOP Visitor pattern Git Tenacity, patience Motivated and able to work independently.

Point of Contact

@RazvanN7