Skip to main content

Sphinx domain and autodoc for Antlr4 grammars

Project description

Sphinx plugin for Antlr4

A4Doc is a sphinx plugin for documenting Antlr4 grammars.

It’s primary target is to provide some overview for DSL users (generated documentation may not include some nuances essential for compiler developers).

A4Doc's features are:

  • a new domain with grammar and rule directives called a4;
  • directives for rendering railroad diagrams;
  • directive for extracting documentation comments and rendering docs and diagrams from .g4 source files.



  • python >= 3.7
  • sphinx >= 1.8.0


pip3 install sphinx-a4doc

Use cases


v1.2.2, v1.2.3, v1.2.4

  • No functional changes, just setting up CI to push PyPI releases automatically.


  • Fixed integration with intersphinx.


  • Renamed settings: a4_autodoc_* became a4_autogrammar_*.
  • Added support for section comments in grammar files.
  • Added flexible settings to control how literal lexer rules are rendered.
  • Added setting to convert rule names from CamelCase to dash-case.
  • Fixed documentation comments are parsed incorrectly in some cases.


  • Fixed absence of .css file for railroad diagrams.


  • Initial release.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sphinx-a4doc, version 1.2.4
Filename, size File type Python version Upload date Hashes
Filename, size sphinx_a4doc-1.2.4-py3-none-any.whl (97.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sphinx-a4doc-1.2.4.tar.gz (95.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page