Awesome ANTLR [](https://awesome.re)

August 4, 2026 · View on GitHub

A curated list of resources for ANTLR (ANother Tool for Language Recognition) — the parser generator, its runtimes across languages, the algorithms behind it, tooling, and real-world grammars.

ANTLR generates lexers and parsers from a single grammar (.g4) file, using the adaptive ALL(*) parsing strategy. This list gathers the foundational research, the runtime targets for each language, editor/analysis tooling, and a catalogue of production grammars published by their vendors.

"ANTLR uses the LL(*) parsing strategy… (it) can handle grammars that are not LL(k) by performing an infinite lookahead… ideal for parsing more complex grammars with multiple viable paths."

— Latif et al., Comparison of Leading Language Parsers (ICSTE 2023)

Contents

Foundations

Papers

Books

The Tool

  • antlr/antlr4 - The reference parser generator and its bundled Java, C#, C++, Go, Python, JavaScript, Dart, and Swift runtimes.
  • antlr-ng - Next-generation TypeScript reimplementation of the ANTLR tool.
  • ANTLR Lab - Browser-based playground to write grammars and visualize parse trees.

Runtime Targets

The reference runtimes for Java, C#, C++, Go, Python3, JavaScript, Dart, and Swift ship inside antlr/antlr4. Notable independent or optimized targets:

  • antlr4-go/antlr - The Go target, published as a standalone Go module.
  • antlr4ng - Modern TypeScript/JavaScript runtime.
  • antlr4cs - Highly-optimized alternative C# target.
  • antlr-php-runtime - Official PHP runtime.
  • antlr-rust-runtime - Pure-Rust runtime and .g4 code generator, no JVM required at build time.
  • antlr4wasm - WebAssembly target for ANTLR4 with a TypeScript interface. On hold: its own benchmarks found the existing JS/TS runtime faster than the compiled-to-WASM build. A Rust-to-WebAssembly path (compact, GC-free output) is a different bet on this idea — tracked as antlr-rust-runtime #143.
  • antlr-kotlin - Kotlin target for ANTLR 4, including Kotlin Multiplatform support.
  • stantler - An early-stage ANTLR4-compatible lexer/parser generator for Common Lisp, generating parser functions directly from .g4 files.

Tooling

  • antlr4-c3 - Grammar-agnostic code-completion engine for ANTLR-based parsers.
  • vscode-antlr4 - Visual Studio Code extension: syntax highlighting, railroad diagrams, ATN visualization, debugging.
  • intellij-plugin-v4 - ANTLR v4 plugin for IntelliJ IDEA: live grammar preview and parse-tree inspection.
  • ANTLR4ParseTreeVisualizer - Visual Studio debugging visualizer and .NET controls for ANTLR 4 parse trees.
  • Grun.Net - A .NET toolset for testing and diagnosing ANTLR 4 grammars, a TestRig alternative for C# parsers.
  • Grammarinator - A grammar-based test generator (fuzzer) that produces random inputs from an ANTLR 4 grammar.
  • rules_antlr - Bazel build rules for running ANTLR on your grammars.

Projects Built on ANTLR

Applications where ANTLR is an implementation detail rather than the interface. Useful as worked references for consuming generated parsers at scale:

  • PMD - Extensible multi-language static analyzer. Its Kotlin and Swift rule engines use ANTLR-generated parse-tree context objects directly as PMD AST nodes — a documented case study in adapting a parse tree to an existing AST interface, including the resulting loss of XPath attributes. Its bundled CPD (Copy/Paste Detector) shows the cheaper integration: fourteen further languages, from C# and Go to Julia and Gherkin, are supported with the lexer alone, matching duplicate code over token streams with no parser or grammar rules involved.
  • Perses - Language-agnostic program reducer that shrinks a failing input while preserving a test-script property. Rather than parsing with a grammar, it treats the grammar as the search space: it reads the .g4 rules and ANTLR's ATN to generate only syntactically valid candidates, avoiding the wasted iterations of Delta Debugging. Introduced at ICSE 2018 (doi:10.1145/3180155.3180236) and extended by a decade of follow-on papers; ships grammars for roughly twenty languages.
  • mehen - Rust CLI computing complexity, maintainability, and documentation metrics across a polyglot codebase. Its Kotlin, Java, and C# frontends run committed ANTLR-generated parsers against antlr-rust-runtime, pinned to an exact version so the generated code and runtime stay in lockstep — a demonstration of the JVM-free build path alongside tree-sitter and native frontends in one binary.

Grammars

Grammar Collections

  • grammars-v4 - The community collection of ANTLR 4 grammars for dozens of languages (action-free, portable).

Vendor-Published Grammars

Grammars maintained by the language/product's own project — first-hand, authoritative sources:

  • Kotlin - Official grammar from the Kotlin Language Specification (JetBrains).
  • C# - The C# grammar in ANTLR notation from the ECMA-334 standard (dotnet/csharpstandard, C# standards committee); also rendered on Microsoft Learn.
  • C# (Roslyn compiler) - Generated by Roslyn's build tooling from Syntax.xml, the same model that generates the compiler's own syntax nodes, so it covers the language as implemented rather than as standardized. Parser-only (no lexer rules), permissive by design since it models error-recovery nodes, and it carries no operator precedence. The ANTLR tool rejects it for mutual left recursion (error(119)); antlr-rust-runtime#221 accepts that subclass and generates a working parser from it.
  • MySQL - Oracle's official MySQL grammar (MySQLParser.g4 / MySQLLexer.g4), used by MySQL Shell.
  • GQL - ANTLR grammar for the ISO/IEC 39075 Graph Query Language. See also TuGraph-family/gql-grammar.
  • Common Expression Language (CEL) - The ANTLR grammar used by the CEL project's Go implementation.
  • Apache Avro IDL - The grammar for Avro's interface description language.
  • Apache Groovy - The official grammar for the Groovy language (GroovyParser.g4 / GroovyLexer.g4).
  • Apache Spark SQL - Spark's SQL dialect grammar (SqlBaseParser.g4).
  • Trino SQL - The SQL grammar for the Trino query engine.
  • Presto SQL - The SQL grammar for the Presto query engine.
  • AWS DQDL - Grammar for the Data Quality Definition Language used by AWS Glue Data Quality.

Community Grammars

Notable standalone grammars maintained by the community:

  • tsqlparser - A T-SQL (SQL Server 2008 R2) grammar for ANTLR 4.
  • cedar-antlr-grammar - An ANTLR grammar for the AWS Cedar policy language.
  • solidity-antlr4 - A grammar for the Solidity smart-contract language.
  • TypeCobol - ANTLR grammars for IBM Enterprise COBOL, from an incremental COBOL parser.
  • quoteparser - A grammar for parsing FX option quotes, a neat example of parsing a non-programming-language notation.
  • PolymorphicDSL Gherkin - A multi-dialect Gherkin (Cucumber BDD) grammar from Google's PolymorphicDSL test framework, with a lexer generated to recognize keywords across many spoken languages.
  • midi-grammar - An experimental grammar that lexes the binary MIDI file format — byte-range tokens and lexer modes for chunk lengths and variable-length quantities — using a Kotlin lexer superClass to handle the length-prefixed reads. A rare example of ANTLR applied to binary data rather than text.
  • dockerfile-antlr4-grammar - A split lexer/parser grammar for Dockerfiles, using lexer modes to separate instruction keywords from their argument text. From WharfLab, whose other container tooling includes the tally Dockerfile linter and a tree-sitter Containerfile grammar; parse trees are checked against BuildKit's own parser.

Benchmarks

Learning

Contributing

Contributions welcome! Please read the contribution guidelines first. Entries must be genuinely useful, accurately described, and point to a real, maintained resource.