abouttreesummaryrefslogcommitdiff
path: root/antlr4-cpp-runtime-4.9.2-source/demo/generate.sh
diff options
context:
space:
mode:
authorPatrick Schönberger2021-08-14 14:56:12 +0200
committerPatrick Schönberger2021-08-14 14:56:12 +0200
commitc6ad2948bb98d42f8e0883ef82cd14cd2d5eda60 (patch)
tree9e83d6d8f61e56f5d3425b8709314d6bdb9315a9 /antlr4-cpp-runtime-4.9.2-source/demo/generate.sh
parent9f94b672a5dc32da5ad01742bd4e976315a30d9c (diff)
downloadtoc-main.tar.gz
toc-main.zip
add antlr source code and ReadMeHEADmain
Diffstat (limited to 'antlr4-cpp-runtime-4.9.2-source/demo/generate.sh')
-rw-r--r--antlr4-cpp-runtime-4.9.2-source/demo/generate.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/antlr4-cpp-runtime-4.9.2-source/demo/generate.sh b/antlr4-cpp-runtime-4.9.2-source/demo/generate.sh
new file mode 100644
index 0000000..2fb8b13
--- /dev/null
+++ b/antlr4-cpp-runtime-4.9.2-source/demo/generate.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+set -o errexit
+
+# Created 2016, Mike Lischke (public domain)
+
+# This script is used to generate source files from the test grammars in the same folder. The generated files are placed
+# into a subfolder "generated" which the demo project uses to compile a demo binary.
+
+# There are 2 ways of running the ANTLR generator here.
+
+# 1) Running from jar. Use the given jar (or replace it by another one you built or downloaded) for generation.
+#LOCATION=antlr4-4.5.4-SNAPSHOT.jar
+#java -jar $LOCATION -Dlanguage=Cpp -listener -visitor -o generated/ -package antlrcpptest TLexer.g4 TParser.g4
+#java -jar $LOCATION -Dlanguage=Cpp -listener -visitor -o generated/ -package antlrcpptest -XdbgST TLexer.g4 TParser.g4
+#java -jar $LOCATION -Dlanguage=Java -listener -visitor -o generated/ -package antlrcpptest TLexer.g4 TParser.g4
+
+# 2) Running from class path. This requires that you have both antlr3 and antlr4 compiled. In this scenario no installation
+# is needed. You just compile the java class files (using "mvn compile" in both the antlr4 and the antlr3 root folders).
+# The script then runs the generation using these class files, by specifying them on the classpath.
+# Also the string template jar is needed. Adjust CLASSPATH if you have stored the jar in a different folder as this script assumes.
+# Furthermore is assumed that the antlr3 folder is located side-by-side with the antlr4 folder. Adjust CLASSPATH if not.
+# This approach is especially useful if you are working on a target stg file, as it doesn't require to regenerate the
+# antlr jar over and over again.
+CLASSPATH=../../../tool/resources/:ST-4.0.8.jar:../../../tool/target/classes:../../../runtime/Java/target/classes:../../../../antlr3/runtime/Java/target/classes
+
+java -cp $CLASSPATH org.antlr.v4.Tool -Dlanguage=Cpp -listener -visitor -o generated/ -package antlrcpptest TLexer.g4 TParser.g4
+#java -cp $CLASSPATH org.antlr.v4.Tool -Dlanguage=Cpp -listener -visitor -o generated/ -package antlrcpptest -XdbgST TLexer.g4 TParser.g4
+#java -cp $CLASSPATH org.antlr.v4.Tool -Dlanguage=Java -listener -visitor -o generated/ TLexer.g4 TParser.g4