Skip to main content

antlr4 ast

· One min read

install

cd ~/.jdks curl -O https://www.antlr.org/download/antlr-4.9.2-complete.jar

cat antlr

#!/bin/sh
java -jar ~/.jdks/antlr-4.9.2-complete.jar $*

cat compile

#!/bin/sh
javac -cp antlr-4.9.2-complete.jar $*

cat grun

#!/bin/sh
java -cp .:$PWD/antlr-4.9.2-complete.jar org.antlr.v4.gui.TestRig $*

run

./antlr myhello/Hello.g -o myhello-out ./compile myhello-out/*.java ./grun myhello-out/Hello s -tokens

antlr -Dlanguage=Python3 Calculantlr.g4 -visitor -o dist_Calculantlr antlr -Dlanguage=Python3 Hello.g -visitor -o dist_Hello antlr -Dlanguage=Python3 PiiCalc.g4 -visitor -o PiiCalc

run go

./antlr -Dlanguage=Go MyGrammar.g