Installation

Java:

You can refer to Installation guide here.

To check if Java is installed:

$ java -version
$ javac -version

Antlr:

Refer to the antlr main website.You can find how to install on Linux, OS X, Windows.

PS: Make sure you put following lines in your source file(.bashrc, .zshrc etc.,)

export CLASSPATH=".:/usr/local/lib/antlr-4.8-complete.jar:$CLASSPATH"
alias antlr4='java -jar /usr/local/lib/antlr-4.8-complete.jar'
alias grun='java org.antlr.v4.gui.TestRig'
$ source ~/.bashrc

Usage

To Compile:

$ cd antlr
$ make 

To Run

General command:

$ grun <name_of_grammar> <root_node/Start Symbol> <path_to_test_file> <option>

Command here:

$ grun Expr prog ../tests/<test_file> -gui