Grammars-v4 is a collection of formal grammars written for ANTLR v4, a parser generator framework.
The repository solves the problem of obtaining reliable, production-ready grammars for parsing a wide variety of programming languages and file formats. Rather than requiring developers to write grammars from scratch, the collection provides pre-built grammars that have been validated and tested. The grammars are written without embedded actions, keeping them clean and focused on syntax specification alone, which makes them easier to maintain and adapt to different target languages that ANTLR v4 supports.
Developers should choose this repository if they need to build a parser or language tool and want to avoid the substantial effort of writing and debugging a grammar from scratch. It suits projects that parse established languages or formats where a grammar already exists in the collection, ranging from mainstream languages like Java and C++ to domain-specific languages and configuration file formats. The repository includes a performance table that allows comparison of grammar parsing speeds across different languages, which can inform decisions about which grammar to use when alternatives exist.
The project maintains automated testing through continuous integration that runs on each pull request merge, alongside weekly builds that generate compiled JAR artifacts and development builds. The repository enforces a code of conduct and house rules that govern contributions, establishing clear expectations for how the collection is maintained and how new grammars should be integrated.