.\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH ANTLR 1 .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH "NAME" ANTLR \- ANother Tool for Language Recognition, version 4 .SH "SYNOPSIS" .B antlr4 [\fIoptions\fR] \fIfile.g4\fR [ \fIfile2.g4\fR \fIfile3.g4\fR ...] .br .SH "DESCRIPTION" ANTLR (ANother Tool for Language Recognition) is a parser generator for reading, processing, executing, or translating structured text or binary files. It's widely used to build languages, tools, and frameworks. From a grammar, ANTLR generates a parser that can build and walk parse trees. .SH "OPTIONS" .TP \fB\-o\fR \fIoutdir\fR Specify output directory where all output is generated. ANTLR generates output files in the current directory by default. This option specifies the output directory where ANTLR should generate parsers, listeners, visitors, and tokens files. .TP \fB\-lib\fR \fIdir\fR Specify location of grammars, tokens files. When looking for tokens files and imported grammars, ANTLR normally looks in the current directory. This option specifies which directory to look in instead. It is only used for resolving grammar references for the import statement and the tokenVocab option. The path to the primary grammar must always be fully specified. .TP \fB\-atn\fR Generate rule augmented transition network diagrams. This option generates DOT graph files that represent the internal ATN (augmented transition network) data structures that ANTLR uses to represent grammars. The files come out as Grammar.rule .dot. If the grammar is a combined grammar, the lexer rules are named Grammar Lexer.rule .dot. .TP \fB\-encoding\fR \fIencodingname\fR Specify grammar file encoding; e.g., euc-jp. By default ANTLR loads grammar files using the UTF-8 encoding, which is a very common character file encoding that degenerates to ASCII for characters that fit in one byte. If that grammar file is not the default encoding for your locale, you need this option so that ANTLR can properly interpret grammar files. This does not affect the input to the generated parsers, just the encoding of the grammars themselves. .TP \fB\-message\-format\fR \fIformat\fR Specify output style for messages in antlr, gnu, vs2005. ANTLR generates warning and error messages using templates from directory tool/resources/org/antlr/v4/tool/templates/messages/formats. By default, ANTLR uses the antlr.stg (StringTemplate group) file. You can change this to 'gnu' or 'vs2005' to have ANTLR generate messages appropriate for Emacs or Visual Studio. To make your own called X, create resource org/antlr/v4/tool/templates/messages/formats/X and place it in the CLASSPATH. .TP \fB\-long-messages\fR Show exception details when available for errors and warnings. .TP \fB\-listener\fR Generate parse tree listener (default). .TP \fB\-no\-listener\fR Don't generate parse tree listener. .TP \fB\-visitor\fR Generate parse tree visitor. ANTLR can generate both parse tree listeners and visitors; this option and \fB\-listener\fR aren’t mutually exclusive. .TP \fB\-no\-visitor\fR Don't generate parse tree visitor (default). .TP \fB\-package\fR \fIpackagename\fR Specify a package/namespace for the generated code. Use this option to specify a package or namespace for ANTLR-generated files. Alternatively, you can add a @header {...} action but that ties the grammar to a specific language. If you use this option and @header, make sure that the header action does not contain a package specification otherwise the generated code will have two of them. .TP \fB\-depend\fR Generate file dependencies. Instead of generating a parser and/or lexer, generate a list of file dependencies, one per line. The output shows what each grammar depends on and what it generates. This is useful for build tools that need to know ANTLR grammar dependencies. If you use \fB\-lib\fR libdir with \fB-depend\fR and grammar option tokenVocab=A, then the dependencies include the library path as well. -Xforce-atn use the ATN simulator for all predictions -Xlog dump lots of logging info to antlr-timestamp.log .TP \fB\-D