Antlr-rust-runtime: a pure-Rust ANTLR v4 runtime + parser generator

⚓ Rust    📅 2026-07-19    👤 surdeus    👁️ 2      

surdeus

Hi all — sharing a project that might be useful to folks here, since "is there a maintained ANTLR for Rust?" comes up from time to time.

antlr-rust-runtime (crate) is a pure-Rust implementation of the ANTLR v4 runtime, plus a .g4 → Rust code generator. No JVM or ANTLR jar is needed at build time, and it has just two runtime dependencies (memchr, thiserror).

Highlights:

  • Passes the official ANTLR runtime conformance suite.
  • Typed parse trees + listener/visitor, with semantic predicates and actions wired through a SemanticHooks trait.
  • Performance-focused. On the cross-runtime MySQL benchmark (Oracle's grammar), run on a single machine, it edges out the C++ runtime overall and is ~2.4× faster than the TypeScript runtime — methodology and numbers are in this PR (single-box comparison, so treat it as indicative rather than a leaderboard).

It's already used in practice (a generated Gremlin parser; an Oracle-MySQL grammar port), but still pre-1.0 — so feedback, grammars that break it, and performance reports are all very welcome. Happy to field ANTLR-in-Rust questions here too.

1 post - 1 participant

Read full topic

🏷️ Rust_feed