This repository contains Jython translations of some of the ANTLR4 examples found in the book "The Definitive ANTLR4 Reference" by Terrance Parr. The original, java examples can be downloaded from: http://pragprog.com/titles/tpantlr2/source_code
The following steps assume:
- jython is in your system's execution path - Jython 2.7b1 was used.
- The ANTLR v4 library (jar file) is in the CLASSPATH.
- a4 command invokes the ANTLR v4 Tool.
- a4 Grammar.g4
- javac Grammar*.java
- jython example.py test_file
tour/Calc.py
- a4 -no-listener -visitor LabeledExpr.g4
- javac LabeledExpr*.java
- jython Calc.py t.expr
tour/ExtractInterfaceTool.py
- a4 Java.g4
- javac Java*.java
- jython ExtractInterfaceTool.py Demo.java
tour/Col.py
- a4 -no-listener Rows.g4
- javac Rows*.java
- jython Col.py 1 t.rows
- jython Col.py 2 t.rows
- jython Col.py 3 t.rows
tour/InsertSerialID.py
- a4 Java.g4
- javac Java*.java
- jython InsertSerialID.py Demo.java
listeners/TestPropertyFile.py
- a4 PropertyFile.g4
- javac PropertyFile*.java
- jython TestPropertyFile.py t.properties
listeners/TestPropertyFileVisitor.py
- a4 -visitor PropertyFile.g4
- javac PropertyFile*.java
- jython TestPropertyFileVisitor.py t.properties
listeners/TestEvaluator.py
- a4 Expr.g4
- javac Expr*.java
- jython TestEvaluator.py t.expr
listeners/LoadCSV.py
- a4 CSV.g4
- javac CSV*.java
- jython LoadCSV.py t.csv
listeners/CallGraph.py
- a4 Cymbol.g4
- javac Cymbol*.java
- jython CallGraph.py t.cymbol > CallGraph.dot
- dot -Tpng CallGraph.dot -o CallGraph.png (*nix Graphviz)