ANN: antlr-format, your flexible friend

Skip to first unread message

Mike Lischke

Nov 25, 2023, 10:53:15 AM11/25/23
to 'ANTLR announcements
What is this about?

I'm pleased to announce another little tool in the ANTLR family: antlr-format, a small library written in TypeScript to format ANTLR4 grammars. It is available in the Github repo and as Node.js package

Even more useful is probably a command line interface for this package, called antlr-format-cli, which provides a terminal application for grammar formatting, available in the same repo, in the cli/ subfolder and as separate Node.js package All necessary details how to use both can be read in their respective readme files.

As test case I opened a pull request in the ANTLR4 grammar repository ( that reformats most of the grammars there (~500 g4 files). 

The command line tool can be used independently of what your preferred programming languages are. The only prerequisite is that a recent Node.js version is installed on your box.

Some more details

The formatter class was originally part of my ANTLR4 extension for VS Code (, from where I extracted it to create the new Node.js package.

I hope you like it and find it useful.
Reply all
Reply to author
0 new messages