Skip to content

alvarofpp/docker-antlr4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker image for ANTLR4

Docker Hub

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.

How to use

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