gitmyhub

grammars-v4

ANTLR ★ 11k updated 1d ago

Grammars written for ANTLR v4; expectation that the grammars are free of actions.

A large open collection of ANTLR v4 grammar files covering dozens of programming languages and file formats, so you can generate a working parser without writing grammar rules from scratch.

ANTLRJavaPythonC#setup: moderatecomplexity 3/5

This repository is a large collection of grammar files written for ANTLR v4. ANTLR is a tool that reads formal grammar descriptions and generates code capable of parsing text written in that language. A grammar file describes the rules of a language: what tokens are valid, how statements are structured, and how different constructs nest inside each other. Once you have a grammar, ANTLR can produce a parser in Java, Python, C#, or several other target languages.

The grammars in this collection cover a wide range of programming languages and file formats: Java, C, C++, C#, Python, SQL dialects, configuration formats, and many others. Each grammar lives in its own directory named after the language it describes, all in lowercase. The stated goal is that the grammars contain no embedded actions, meaning they are pure structural descriptions without language-specific code mixed in. This makes them easier to reuse across different ANTLR target languages.

This collection is maintained under the ANTLR organization on GitHub, which is the same group behind the ANTLR parser generator itself. If you are building a tool that needs to read or analyze source code in an existing language, starting from one of these grammars saves considerable time compared to writing the grammar rules from scratch. Contributors can add new grammars or improve existing ones following the project's house rules.

The README itself is minimal and points to a project Wiki for frequently asked questions and contribution guidelines. Beyond the directory structure and a continuous integration badge, the repository speaks through its grammar files rather than detailed documentation.

Where it fits