A docker image based in Alpine for ANTLR4, inspired by the official image.
docker pull alvarofpp/antlr4
If you want to start a project using ANTLR4, I recommend using the following boilerplate: alvarofpp/boilerplate-antlr4.
Generate files from your grammar:
docker run --rm -u $(id -u) -v $(pwd):/work alvarofpp/antlr4 antlr -Dlanguage=Java Expr.g4
Compile:
docker run --rm -u $(id -u) -v $(pwd):/work alvarofpp/antlr4 javac src/Expr*.java
View using the GUI (tested on Ubuntu 20.04.3 LTS):
docker run --rm -u $(id -u) -it \
-e DISPLAY=$(hostname -I | cut -f1 -d' '):0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $(pwd)/src:/work alvarofpp/antlr4 grun Expr prog -gui