Antlr - antlr4.(bat|sh)

Card Puncher Data Processing


antlr4.(bat|sh) is the command line script of Antlr.


See Installation

Syntax (Options)

ANTLR Parser Generator  Version 4.8
 -o ___              specify output directory where all output is generated
 -lib ___            specify location of grammars, tokens files
 -atn                generate rule augmented transition network diagrams
 -encoding ___       specify grammar file encoding; e.g., euc-jp
 -message-format ___ specify output style for messages in antlr, gnu, vs2005
 -long-messages      show exception details when available for errors and warnings
 -listener           generate parse tree listener (default)
 -no-listener        don't generate parse tree listener
 -visitor            generate parse tree visitor
 -no-visitor         don't generate parse tree visitor (default)
 -package ___        specify a package/namespace for the generated code
 -depend             generate file dependencies
 -D<option>=value    set/override a grammar-level option
 -Werror             treat warnings as errors
 -XdbgST             launch StringTemplate visualizer on generated code
 -XdbgSTWait         wait for STViz to close before continuing
 -Xforce-atn         use the ATN simulator for all predictions
 -Xlog               dump lots of logging info to antlr-timestamp.log
 -Xexact-output-dir  all output goes into -o dir regardless of paths/package


where D… is a grammar options. Example for the language:

antlr4 -Dlanguage=Java T.g4 # default
antlr4 -Dlanguage=C T.g4
antlr4 -Dlanguage=Python2 T.g4


antlr4 ^
    -o %ProjectRoot%\gen ^ 
    -listener ^
    -visitor ^
    -lib %ProjectRoot%/src/main/antlr4/com/group/package/lexer ^ # output dir


Discover More
Card Puncher Data Processing
ANTLR - Tool

The ANTLR tool helps create the grammar and generate its corresponding lexer+parser code. It can be run from the following application: ANTLR Intellij plug-in ANTLRWorks antlr4 - the command...
Card Puncher Data Processing
Antlr - Generated class

From the grammar The lexer rules will create the lexer class The parser rules will create the parser class The classes generated will contain a method for each rule in the grammar. See from...
Idea Antlr Right Click Options
Antlr - Getting Started (Hello World)

A getting started page that brings you in the world of Antlr. antlr/antlr4/blob/master/doc/getting-started.mdantlr4 getting-started Create a grammar file called Hello.g4 and define the grammar...
Card Puncher Data Processing
Antlr - Grammar Option

Option for the grammar Grammar options are specified using the following syntax. antlr/antlr4/blob/master/doc/
Idea Antlr Right Click Options
Antlr - Idea Plugin

The Idea plugin is a plugin for Idea that install the Antlr tool. Create a grammar file with the extension g4 and Idea should propose you to install the Antlr...
Idea Antlr Right Click Options
Antlr - Installation (Version 4)

Installation of Antlr tool on . on Idea Create a grammar file with the extension g4 and Idea should propose you to install the Antlr plugin Right click on your g4 file, you should see the...

Share this page:
Follow us:
Task Runner