Setup ANTLR4 and Makefiles in Windows [Cygwin]

Setup ANTLR4 and Makefiles in Windows
Setup ANTLR4 and Makefiles in Windows

Install Java Runtime Environment (JRE)

Start by installing the JRE:

https://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Install Java Development Kit (JDK)

Next, install the JDK:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Afterward, add “C:\Program Files\Java\jdk1.8.0_181\bin” to your PATH environment variable.

Install Cygwin

Install Cygwin: https://www.cygwin.com/

Rember to add “make” to install under Development packages.

Install ANTLR4

Download the Javalib zip-file from ANTLR website.

https://www.antlr.org/download.html

Set Environment variables

Open “Environment Variables”

Add to or create “CLASSPATH”-variable “C:\Javalib\antlr-4.7.1-complete.jar;”

Add to “PATH”-variable “;C:\Javalib\;”

IF not already there, add to “PATH”-variable: “;C:\ProgramFiles\Java\jdk1.8.1_181\bin;”

Setting up Cygwin

Run: $ export PATH=$PATH:”/cygdrive/c/Program Files/Java/jdk1.8.0_181/bin”

Run makefiles and java .class-files from Cygwin

Edit path to antlr4 in Makefile line 1 to: “/Javalib/antlr-4.7.1-complete.jar”

Navigate to C:\ in Cygwin, run: $ cd /cygdrive/c

To run makefile, run: $ make

To run parser, run: $ java main java_input.txt