INRIA / spoon

Spoon is a metaprogramming library to analyze and transform Java source code. :spoon: is made with :heart:, :beers: and :sparkles:. It parses source files to build a well-designed AST with powerful analysis and transformation API.
http://spoon.gforge.inria.fr/
Other
1.74k stars 348 forks source link

[related] source code analysis and transformations tools related to Spoon #3574

Open monperrus opened 4 years ago

monperrus commented 4 years ago

this issue is about tools related to Spoon, related to source code analysis and transformation.

(#1908 is about papers)

(Moving ones from #1303 here)

monperrus commented 4 years ago

FYI: https://github.com/jhipster/prettier-java is a "A Prettier plugin [to] parse the source code of the target language into an Abstract Syntax Tree and then print out the AST in a pretty style. Prettier-Java uses a Java-Parser implemented in JavaScript with the Chevrotain parsing library"

monperrus commented 4 years ago

Roaster: "A Java Parser library that allows easy parsing and formatting of Java source files" https://github.com/forge/roaster

monperrus commented 4 years ago

Another parsing tool made at Github: https://github.com/tree-sitter/tree-sitter

monperrus commented 4 years ago

Big AST-based refactoring tool for PHP: https://github.com/rectorphp/rector

monperrus commented 4 years ago

shift-ast Represents the structure of an ECMAScript program as an abstract syntax tree https://shift-ast.org/

monperrus commented 4 years ago

Library to read, analyze, transform and generate Scala programs https://scalameta.org/

seintur commented 4 years ago

OpenC++ is C++ frontend library (lexer+parser+DOM/MOP) and source-to-source translator http://opencxx.sourceforge.net

monperrus commented 3 years ago

Manifold (http://manifold.systems/) provides:

....

See also https://github.com/manifold-systems/manifold/tree/master/manifold-core-parent/manifold

seintur commented 3 years ago

JavaParser tools for Java code Analyse Transform Generate https://github.com/javaparser/javaparser

nharrand commented 3 years ago

Cubix: a multi language tool for source to source transformations http://www.cubix-framework.com

monperrus commented 3 years ago

FTR we must have CIL in this thread :)

monperrus commented 3 years ago

ROSE is a robust, open source, compiler-based infrastructure for building source to source program transformation and analysis tools developed at Lawrence Livermore National Laboratory. ROSE Tools can process large C, C++, Fortran, OpenMP, and UPC source codes, as well as binary executables.

http://rosecompiler.org/

monperrus commented 3 years ago

Olmar: manipulating C and C++ abstract syntax trees in Ocaml

monperrus commented 2 years ago

OpenRewrite is a mass refactoring ecosystem for Java and other source code, designed to eliminate technical debt across an engineering organization. https://github.com/openrewrite/rewrite

main contributors: @jkschneider @sambsnyd

monperrus commented 2 years ago

FYI: Semgrep can do matching (related to template matching and SMPL in Spoon) and automated transformations https://semgrep.dev/

cc/ @IagoAbal @mjambon @aryx @mschwager

aryx commented 2 years ago

It can indeed!

monperrus commented 2 years ago

structured template / search and replace replacement in intelliJ https://www.jetbrains.com/help/idea/structural-search-and-replace.html

thanks @MartinWitt for the pointer

monperrus commented 2 years ago

JavaScript syntax tree transformer, nondestructive pretty-printer, and automatic source map generator https://github.com/benjamn/recast by @benjamn

monperrus commented 2 years ago

Comby: A code rewrite tool for structural search and replace that supports ~every language. https://github.com/comby-tools/comby

cc/ @rvantonder

monperrus commented 2 years ago

Codemods (library to assist you with large-scale codebase refactors):

See also https://github.com/rajasegar/awesome-codemods

thanks @rarkins for the pointer

monperrus commented 1 year ago

com.facebook.kotlin.asttools containing some utilities we use to simplify work with the Kotlin compiler API https://github.com/fbsamples/kotlin_ast_tools

monperrus commented 9 months ago

Rerast is a search/replace tool for Rust code using rules, by Google https://github.com/google/rerast

monperrus commented 8 months ago

Hyperast: ASTs over Git histories, fast, in Rust

https://github.com/HyperAST/HyperAST

by @quentinLeDilavrec