ANTLR TestRig Command and Options

Q

What is the ANTLR TestRig command and its options? I have downloaded the antlr-4.7.1-complete.jar.

✍: FYIcenter

A

ANTLR TestRig allows you to test the lexer and parser generated by ANTLR interactively from the command prompt.

The main class of ANTLR TestRig is org.antlr.v4.gui.TestRig. You can see its command arguments and options by running it:

\fyicenter>java -cp \antlr-4.7.1-complete.jar org.antlr.v4.gui.TestRig

java org.antlr.v4.gui.TestRig GrammarName startRuleName
  [-tokens] [-tree] [-gui] [-ps file.ps] [-encoding encodingname]
  [-trace] [-diagnostics] [-SLL]
  [input-filename(s)]
Use startRuleName='tokens' if GrammarName is a lexer grammar.
Omitting input-filename makes rig read from stdin.

You can provide your source code as an input file, or from the console interactively. The lexer and parser classes generated from ANTLR must be included in the classpath.

 

ANTLR "Hello" Grammar File and Test

ANTLR Command and Options

ANTLR Commands and Examples

⇑⇑ FAQ for ANTLR Parser Generator

2020-12-02, 6650👍, 0💬