All Projects → javaparser → Javaparser

javaparser / Javaparser

Licence: other
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Javaparser

Spoon
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.
Stars: ✭ 1,078 (-72.86%)
Mutual labels:  ast, abstract-syntax-tree, parser, code-generation, code-analysis
Astexplorer.app
https://astexplorer.net with ES Modules support and Hot Reloading
Stars: ✭ 65 (-98.36%)
Mutual labels:  ast, syntax-tree, parser
Vermin
Concurrently detect the minimum Python versions needed to run code
Stars: ✭ 218 (-94.51%)
Mutual labels:  ast, abstract-syntax-tree, parser
Metric Parser
📜 AST-based advanced mathematical parser written by Typescript.
Stars: ✭ 26 (-99.35%)
Mutual labels:  ast, syntax-tree, parser
Libdparse
Library for lexing and parsing D source code
Stars: ✭ 91 (-97.71%)
Mutual labels:  ast, syntax-tree, parser
Cgen
C/C++ source generation from an AST
Stars: ✭ 107 (-97.31%)
Mutual labels:  ast, abstract-syntax-tree, code-generation
Bblfshd
A self-hosted server for source code parsing
Stars: ✭ 297 (-92.52%)
Mutual labels:  ast, parser, code-analysis
Escaya
An blazing fast 100% spec compliant, incremental javascript parser written in Typescript
Stars: ✭ 217 (-94.54%)
Mutual labels:  ast, syntax-tree, parser
abstract-syntax-tree
A library for working with abstract syntax trees.
Stars: ✭ 77 (-98.06%)
Mutual labels:  ast, syntax-tree, abstract-syntax-tree
bright
Blazing fast parser for BrightScript that gives you ESTree like AST
Stars: ✭ 28 (-99.3%)
Mutual labels:  ast, syntax-tree
Efdesigner
Entity Framework visual design surface and code-first code generation for EF6, Core and beyond
Stars: ✭ 256 (-93.55%)
Mutual labels:  code-generation, code-generator
Pyverilog
Python-based Hardware Design Processing Toolkit for Verilog HDL
Stars: ✭ 267 (-93.28%)
Mutual labels:  parser, code-generator
Hast
Hypertext Abstract Syntax Tree format
Stars: ✭ 344 (-91.34%)
Mutual labels:  ast, syntax-tree
php-code-generator
PHP code generator library
Stars: ✭ 144 (-96.37%)
Mutual labels:  code-generator, code-generation
Reinforced.typings
Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free
Stars: ✭ 341 (-91.41%)
Mutual labels:  ast, code-generator
ast-builder
Build your ASTs directly from code
Stars: ✭ 18 (-99.55%)
Mutual labels:  ast, abstract-syntax-tree
Xmlschemaclassgenerator
Generate C# classes from XML Schema files
Stars: ✭ 277 (-93.03%)
Mutual labels:  code-generation, code-generator
Fpp
Functional PHP Preprocessor - Generate Immutable Data Types
Stars: ✭ 282 (-92.9%)
Mutual labels:  code-generation, code-generator
qm
QM model-based design tool and code generator based on UML state machines
Stars: ✭ 54 (-98.64%)
Mutual labels:  code-generator, code-generation
Jsqlparser
JSqlParser parses an SQL statement and translate it into a hierarchy of Java classes. The generated hierarchy can be navigated using the Visitor Pattern
Stars: ✭ 3,405 (-14.27%)
Mutual labels:  ast, parser

JavaParser

Maven Central Build Status Coverage Status Join the chat at https://gitter.im/javaparser/javaparser License LGPL-3/Apache-2.0 DOI

This project contains a set of libraries implementing a Java 1.0 - Java 15 Parser with advanced analysis functionalities. This includes preview features to Java 13, with Java 14 preview features work-in-progress.

Our main site is at JavaParser.org

Setup

The project binaries are available in Maven Central.

We strongly advise users to adopt Maven, Gradle or another build system for their projects. If you are not familiar with them we suggest taking a look at the maven quickstart projects (javaparser-maven-sample, javasymbolsolver-maven-sample).

Just add the following to your maven configuration or tailor to your own dependency management system.

Please refer to the Migration Guide when upgrading from 2.5.1 to 3.0.0+

Maven:

<dependency>
    <groupId>com.github.javaparser</groupId>
    <artifactId>javaparser-symbol-solver-core</artifactId>
    <version>3.23.1</version>
</dependency>

Gradle:

implementation 'com.github.javaparser:javaparser-symbol-solver-core:3.23.1'

Since Version 3.5.10, the JavaParser project includes the JavaSymbolSolver. While JavaParser generates an Abstract Syntax Tree, JavaSymbolSolver analyzes that AST and is able to find the relation between an element and its declaration (e.g. for a variable name it could be a parameter of a method, providing information about its type, position in the AST, ect).

Using the dependency above will add both JavaParser and JavaSymbolSolver to your project. If you only need the core functionality of parsing Java source code in order to traverse and manipulate the generated AST, you can reduce your projects boilerplate by only including JavaParser to your project:

Maven:

<dependency>
    <groupId>com.github.javaparser</groupId>
    <artifactId>javaparser-core</artifactId>
    <version>3.23.1</version>
</dependency>

Gradle:

implementation 'com.github.javaparser:javaparser-core:3.23.1'

Since version 3.6.17 the AST can be serialized to JSON. There is a separate module for this:

Maven:

<dependency>
    <groupId>com.github.javaparser</groupId>
    <artifactId>javaparser-core-serialization</artifactId>
    <version>3.23.1</version>
</dependency>

Gradle:

implementation 'com.github.javaparser:javaparser-core-serialization:3.23.1'

How To Compile Sources

If you checked out the project's source code from GitHub, you can build the project with maven using:

mvnw clean install

If you want to generate the packaged jar files from the source files, you run the following maven command:

mvnw package

NOTE the jar files for the two modules can be found in:

  • javaparser/javaparser-core/target/javaparser-core-\<version\>.jar
  • javaparser-symbol-solver-core/target/javaparser-symbol-solver-core-\<version\>.jar

If you checkout the sources and want to view the project in an IDE, it is best to first generate some of the source files; otherwise you will get many compilation complaints in the IDE. (mvnw clean install already does this for you.)

mvnw javacc:javacc

If you modify the code of the AST nodes, specifically if you add or remove fields or node classes, the code generators will update a lot of code for you. The run_metamodel_generator.sh script will rebuild the metamodel, which is used by the code generators which are run by run_core_generators.sh Make sure that javaparser-core at least compiles before you run these.

Note: for Eclipse IDE follow the steps described in the wiki: https://github.com/javaparser/javaparser/wiki/Eclipse-Project-Setup-Guide

More information

JavaParser.org is the main information site.

License

JavaParser is available either under the terms of the LGPL License or the Apache License. You as the user are entitled to choose the terms under which adopt JavaParser.

For details about the LGPL License please refer to LICENSE.LGPL.

For details about the Apache License please refer to LICENSE.APACHE.

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].