All Projects → INRIA → Spoon

INRIA / Spoon

Licence: other
Spoon is a metaprogramming library to analyze and transform Java source code (up to Java 15). 🥄 is made with ❤️, 🍻 and ✨. It parses source files to build a well-designed AST with powerful analysis and transformation API.

Programming Languages

java
68154 projects - #9 most used programming language
metaprogramming
66 projects

Projects that are alternatives of or similar to Spoon

Javaparser
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13
Stars: ✭ 3,972 (+268.46%)
Mutual labels:  ast, abstract-syntax-tree, parser, code-generation, code-analysis
Vermin
Concurrently detect the minimum Python versions needed to run code
Stars: ✭ 218 (-79.78%)
Mutual labels:  ast, abstract-syntax-tree, parser
Ts Morph
TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Stars: ✭ 2,384 (+121.15%)
Mutual labels:  static-analysis, ast, code-generation
Cgen
C/C++ source generation from an AST
Stars: ✭ 107 (-90.07%)
Mutual labels:  ast, abstract-syntax-tree, code-generation
Bellybutton
Custom Python linting through AST expressions
Stars: ✭ 196 (-81.82%)
Mutual labels:  static-analysis, ast, abstract-syntax-tree
Php Parser
A PHP parser written in PHP
Stars: ✭ 15,101 (+1300.83%)
Mutual labels:  static-analysis, ast, parser
Bblfshd
A self-hosted server for source code parsing
Stars: ✭ 297 (-72.45%)
Mutual labels:  ast, parser, code-analysis
Php Parser
🌿 NodeJS PHP Parser - extract AST or tokens (PHP5 and PHP7)
Stars: ✭ 400 (-62.89%)
Mutual labels:  ast, parser
Tiny Compiler
A tiny compiler for a language featuring LL(2) with Lexer, Parser, ASM-like codegen and VM. Complex enough to give you a flavour of how the "real" thing works whilst not being a mere toy example
Stars: ✭ 425 (-60.58%)
Mutual labels:  ast, parser
Tenko
An 100% spec compliant ES2021 JavaScript parser written in JS
Stars: ✭ 490 (-54.55%)
Mutual labels:  ast, parser
Postcss
Transforming styles with JS plugins
Stars: ✭ 25,612 (+2275.88%)
Mutual labels:  ast, parser
Credo
A static code analysis tool for the Elixir language with a focus on code consistency and teaching.
Stars: ✭ 4,144 (+284.42%)
Mutual labels:  static-analysis, code-analysis
Astexplorer
A web tool to explore the ASTs generated by various parsers.
Stars: ✭ 4,330 (+301.67%)
Mutual labels:  ast, parser
Eslint Plugin Sonarjs
SonarJS rules for ESLint
Stars: ✭ 458 (-57.51%)
Mutual labels:  static-analysis, code-analysis
I18nize React
Internationalize react apps within a lunch break
Stars: ✭ 389 (-63.91%)
Mutual labels:  ast, abstract-syntax-tree
Meriyah
A 100% compliant, self-hosted javascript parser - https://meriyah.github.io/meriyah
Stars: ✭ 690 (-35.99%)
Mutual labels:  ast, parser
Swaggen
OpenAPI/Swagger 3.0 Parser and Swift code generator
Stars: ✭ 385 (-64.29%)
Mutual labels:  parser, code-generation
Webassemblyjs
Toolchain for WebAssembly
Stars: ✭ 566 (-47.5%)
Mutual labels:  ast, parser
Tolerant Php Parser
An early-stage PHP parser designed for IDE usage scenarios.
Stars: ✭ 717 (-33.49%)
Mutual labels:  ast, parser
Proposal Binary Ast
Binary AST proposal for ECMAScript
Stars: ✭ 831 (-22.91%)
Mutual labels:  ast, parser

Maven Central Travis Build Status Coverage Status Maintainability Rating

Spoon

Spoon is an open-source library to analyze, rewrite, transform, transpile Java source code. It parses source files to build a well-designed AST with powerful analysis and transformation API. It fully supports modern Java versions up to Java 11, 12, 13, 14. Spoon is an official Inria open-source project, and member of the OW2 open-source consortium.

Documentation

The latest official documentation is available at http://spoon.gforge.inria.fr/ and a regularly updated PDF version is as https://projects.ow2.org/download/spoon/WebHome/spoon-user-manual.pdf.

Academic usage

If you use Spoon for academic purposes, please cite: Renaud Pawlak, Martin Monperrus, Nicolas Petitprez, Carlos Noguera, Lionel Seinturier. “Spoon: A Library for Implementing Analyses and Transformations of Java Source Code”. In Software: Practice and Experience, Wiley-Blackwell, 2015. Doi: 10.1002/spe.2346.

@article{pawlak:hal-01169705,
  TITLE = "{Spoon: A Library for Implementing Analyses and Transformations of Java Source Code}",
  AUTHOR = {Pawlak, Renaud and Monperrus, Martin and Petitprez, Nicolas and Noguera, Carlos and Seinturier, Lionel},
  JOURNAL = "{Software: Practice and Experience}",
  PUBLISHER = "{Wiley-Blackwell}",
  PAGES = {1155-1179},
  VOLUME = {46},
  URL = {https://hal.archives-ouvertes.fr/hal-01078532/document},
  YEAR = {2015},
  doi = {10.1002/spe.2346},
}

Professional support

If you need professional support on Spoon (development, training, extension), you are welcome to post a comment on https://github.com/INRIA/spoon/issues/3251

Getting started in 2 seconds

Get latest stable version with Maven, see https://search.maven.org/artifact/fr.inria.gforge.spoon/spoon-core

And start using it:

CtClass l = Launcher.parseClass("class A { void m() { System.out.println(\"yeah\");} }");

Documentation:

Contributing in 2 seconds

Create your first pull-request to improve the documentation, see doc! Proceed with your first bug fix! The community is open-minded, respectful and patient. All external contributions are welcome.

Design Philosophy

R1) The Spoon metamodel is as close as possible to the language concepts.

R2) The Spoon model of a program is complete and sound.

R3) The text version of a Spoon model is well-formed and semantically equivalent to the original program.

R4) The analysis and transformation API is intuitive and regular.

R5) Transformation operators are designed to warn as fast as possible about invalid programs. This is done either with static type checking or with dynamic checks when the operators are used.

R6) When feasible, the text version of a Spoon model is close to the original one.

Compiling

To compile Spoon, you need a Java Development Kit (JDK) and Maven:

git clone https://github.com/INRIA/spoon
cd spoon
mvn compile

To run the tests:

mvn test

Download

Latest version: https://search.maven.org/remote_content?g=fr.inria.gforge.spoon&a=spoon-core&v=LATEST&c=jar-with-dependencies - Javadoc

Maven:

<dependency>
    <groupId>fr.inria.gforge.spoon</groupId>
    <artifactId>spoon-core</artifactId>
    <!-- See rendered release value at http://spoon.gforge.inria.fr/ -->
    <version>{{site.spoon_release}}</version>
</dependency>

Releases

  • July 2020: Spoon 8.2.0 (changelog)
  • March 2020: Spoon 8.1.0 (changelog)
  • November 2019, Spoon 8.0.0 (changelog)
  • July 2019: Spoon 7.5.0 is released (changelog)
  • May 2019: Spoon 7.4.0 is released (changelog)
  • Februray 10, 2019: Spoon 7.3.0 is released (changelog)
  • December 4, 2018: Spoon 7.2.0 is released (changelog)
  • October 10, 2018: Spoon 7.1.0 is released (changelog)
  • July 4, 2018: Spoon 7.0.0 is released (changelog)
  • March 8, 2018: Spoon 6.2.0 is released (changelog)
  • December 20, 2017: Spoon 6.1.0 is released, merry christmas! 🎄 (changelog)
  • November 17, 2017: Spoon 6.0.0 is released! Check the (changelog) as there are few non backward-compatible changes ⚠️
  • September 6, 2017: Spoon 5.9.0 is released (changelog) back-to-work release!
  • July 11, 2017: Spoon 5.8.0 is released (changelog) Summer release 🍺 To be prefered wrt the previous one: fix lot of bugs.
  • June 01, 2017: Spoon 5.7.0 is released (changelog)
  • March 16, 2017: Spoon 5.6.0 is released (changelog) Spring release :-)
  • January 11, 2017: Spoon 5.5.0 is released (changelog). Happy new year!
  • October 27, 2016: Spoon 5.4.0 is released (changelog).
  • September 19, 2016: Spoon 5.3.0 is released (changelog).
  • June 30, 2016: Spoon 5.2.0 is released (changelog).
  • June 22, 2016: Spoon 5.1.1 is released (changelog).
  • March 21, 2016: Spoon 5.1.0 is released (changelog).
  • February 12, 2016: Spoon 5.0.2 is released (changelog).
  • February 3, 2016: Spoon 5.0.1 is released (changelog).
  • January 25, 2016: Spoon 5.0.0 is released (changelog).
  • November 18, 2015: Spoon 4.4.1 is released (changelog).
  • November 16, 2015: Spoon 4.4.0 is released (changelog).
  • September 22, 2015: Spoon 4.3.0 is released (changelog).
  • June 15, 2015: Spoon 4.2.0 is released (changelog).
  • May 7, 2015: Spoon 4.1.0 is released (changelog).
  • April 8, 2015: Spoon 4.0.0 is released (changelog).
  • February 11, 2015: Spoon 3.1 is released (changelog).
  • December 9, 2014: Spoon 3.0 is released (changelog).
  • November 12, 2014: Spoon 2.4 is released (changelog).
  • October 9, 2014: Spoon 2.3.1 is released (changelog).
  • September 12, 2014: Spoon 2.1 is released (changelog).
  • April 2, 2014: Spoon 2.0 is released (changelog).
  • September 30, 2013: Spoon 1.6 is released.
  • April 12, 2012: Spoon 1.5 is released.

License

Spoon is Free and Open Source, double-licensed under the (CeCILL-C license - French equivalent to LGPL) and the MIT license.

Github Contributors

Alphabetical order of last names

git log --pretty="%an" | sed -e '/Spoon Bot/d' | sort -u | awk 'NF>=2 {print "* " $0}' | sort -k3
  • David Bernard
  • Artur Bosch
  • Egor Bredikhin
  • Maxime CLEMENT
  • Benoit Cornu
  • Andre Cruz
  • Benjamin DANGLOT
  • Scott Dickerson
  • Yann Diorcet
  • Thomas Durieux
  • Sergey Fedorov
  • Alcides Fonseca
  • Clement Fournier
  • Jan Galinski
  • Nicolas Harrand
  • Mickael Istria
  • Mehdi Kaytoue
  • Urs Keller
  • Filip Krakowski
  • Lukas Krejci
  • Ashutosh Kumar Verma
  • Roman Leventov
  • Fan Long
  • Kai Luo
  • Matias Martinez
  • Luke Merrick
  • Martin Monperrus
  • Vincenzo Musco
  • Carlos Noguera
  • Gerard Paligot
  • Renaud Pawlak
  • Nicolas Petitprez
  • Phillip Schichtel
  • Lionel Seinturier
  • Miguel Sozinho Ramalho
  • Marcel Steinbeck
  • Christopher Stokes
  • Eddie T
  • Simon Urli
  • Pavel Vojtechovsky
  • Stefan Wolf
  • Diorcet Yann
  • Gregor Zeitlinger
  • Tomasz Zielinski

Early contributors:

  • Olivier Barais
  • David Bernard
  • Benoit Cornu
  • Favio DeMarco
  • Didier Donsez
  • Christophe Dufour
  • Sebastian Lamelas Marcote
  • Matias Martinez
  • Carlos Noguera
  • Renaud Pawlak
  • Nicolas Pessemier
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].