JavaParser
grammars-v4
Our great sponsors
JavaParser | grammars-v4 | |
---|---|---|
6 | 29 | |
5,172 | 9,721 | |
1.7% | 1.5% | |
9.5 | 9.6 | |
2 days ago | about 6 hours ago | |
Java | ANTLR | |
GNU General Public License v3.0 or later | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
JavaParser
-
Things I didn't know about Java: Generic Constructors
As I have never seen generic constructors before I wanted to know how "real-world" code uses them. So I wrote a program that parses the Java files in the JDK source code. It uses the JavaParser open-source library. Since its README file mentions Java 15, I ran the program on tag jdk-15+36 of the JDK source code.
-
Static Analysis at GitHub
GitHub released a pretty good java parser that I think is is related to this work https://github.com/javaparser/javaparser
I'm also using that parser using for a side project where developers can cross link their source code and host them statically: https://github.com/josephmate/OdinCodeBrowser#readme
-
An open-source Java application to Test
JavaParser
-
Automatically unlocking concurrent builds and fine-grained caching for Java with dependency inference
So after taking a deeper look into the docs I've seen that analysis is done via https://github.com/javaparser/javaparser/ lib which has currently only support up to JDK14 (not JDK15, JDK16 nor JDK17...maybe JDK18)...Unfortunately I have not found a full working example for a Java build ...can you give a link?
-
Bulk Refactoring of Java Code
Depending on the type of refactorings needed, you may be able to use something like Java parser to read the code, refractor it, and write it out again.
grammars-v4
- Operadores de adição e subtração
-
Postgres Language Server: Implementing the Parser
Where is the SQLite test suite, please? I'd be very interested.
There are already SQL grammars, check https://github.com/antlr/grammars-v4 specifically in here I think https://github.com/antlr/grammars-v4/tree/master/sql I contributed to one of them, and I wrote my own for some personal work. Be warned, it's very involved, very complex and MSSQL is rather ill-defined.
Names bracket identifiers) in SQL are bloody awful. Sometimes square brackets are even compulsory, and why you can usually replace [...] with the SQL standard "..." , not always! Trust me, it gets worse.
I don't find antlr grammars to be brittle, and while they can lose in performance (by how much I don't know, perhaps quite considerably) they are very easy to maintain and I am very fortunate to have antlr to work with.
-
Llama: Add Grammar-Based Sampling
This grammar "library" was cited as an example of what the format could look like:.
https://github.com/antlr/grammars-v4
There is everything from assembly and C++ to glsl and scripting languages, arithmetic, games, and other weird formats.
-
Structured Output from LLMs (Without Reprompting!)
> Which brings me to the other approach: steering the LLM's output __as it is generating tokens__
A relevant PR:
https://github.com/ggerganov/llama.cpp/pull/1773
The plan is to support arbitrary grammar files to constrain tokens as they are generated, like the ones here:
-
SQL-Parsing
Have a look at jooq - I know this has been used to rewrite SQL from one dialect to another, so it MUST be capable of collating code activity metrics. Look here. Otherwise, you might want to look into writing your own parser. ANTLR has a T-SQL dialect parser script here.
-
How should I prepare for AI-driven changes in the industry as a Software Engineering Manager
Find a Perl grammar file for ANTLR, like https://github.com/antlr/grammars-v4/tree/master/perl Save the grammar file as Perl.g4 in your project. Now, you can create the Kotlin program: import org.antlr.v4.runtime.* import org.antlr.v4.runtime.tree.ParseTree import java.io.File
-
DELD: An experimental HTTP-Client
Antlr is another option. You could generate a parser using the JSON antlr grammar.
- lang.g4: ANTLR4 Grammar for different programming languages
-
SQLite Internals: How the Most Used Database Works
> ...than it would be to learn the exact syntax and quirks and possibly bugs of someone else's implementation...
Yup. Also, having deep knowledge of the language is required.
SQLite's grammar is neat. Creating a compatible parser would make a fun project. Here's a pretty good example: https://github.com/bkiers/sqlite-parser (Actual ANTLR 4 grammar: https://github.com/bkiers/sqlite-parser/blob/master/src/main... )
Postgres, which tries to be compliant with the latest standards, however...
SQL-2016 is a beast. Not to mention all the dialects.
I'm updating my personal (soon to be FOSS) grammar from ANTLR 3 LL(k) to ANTLR 4 ALL().
I've long had a working knowledge of SQL-92, with some SQL-1999 (eg common table expressions).
But the new structures and extensions are a bit overwhelming.
Fortunately, ANTLR project has ~dozen FOSS grammars to learn from. https://github.com/antlr/grammars-v4/tree/master/sql
They mostly mechanically translate BNFs to LL(k) with some ALL(). Meaning few take advantage of left-recursion. https://github.com/antlr/antlr4/blob/master/doc/left-recursi...
Honestly, I struggled to understand these grammars. Plus, not being conversant with the SQL-2016 was a huge impediment. Just finding a succinct corbis of test cases was a huge hurdle for me.
Fortunately, the H2 Database project is a great resource. https://github.com/h2database/h2database/tree/master/h2/src/...
Now for the exciting conclusion...
My ANTLR grammar which passes all of H2's tests looks nothing like any of the official or product specific BNFs.
Further, I found discrepancy between the product specific BNFs and their implementations.
So a lot of trial & error is required for a "real world" parser. Which would explain why the professional SQL parsing tools charge money.
I still think creating a parser for SQLite is a great project.
-
.NET-compatible scripting languages for users to write their own scripts to query/manipulate objects/properties in the app
You can find C# grammar files already defined online: https://github.com/antlr/grammars-v4/tree/master/csharp
What are some alternatives?
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.
Lombok - Very spicy additions to the Java programming language.
rewrite - Automated mass refactoring of source code.
JavaSymbolSolver
NoException
JHipster - JHipster, much like Spring initializr, is a generator to create a boilerplate backend application, but also with an integrated front end implementation in React, Vue or Angular. In their own words, it "Is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures."
ANTLR - ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
DCEVM - Dynamic Code Evolution VM for Java 7/8
AspectJ
Spring Loaded - Java agent that enables class reloading in a running JVM
javaparser-visited - Code samples for the book "JavaParser: Visited" https://leanpub.com/javaparservisited
Auto - A collection of source code generators for Java.