Seawolf Interpreter
To install ANTLR4 follow the instructions here (https://github.com/ANTLR/ANTLR4/blob/master/doc/getting-started.md ) but replace antlr-4.5.3
with antlr-4.6
.
Then install the python runtime here (https://pypi.python.org/pypi/antlr4-python3-runtime/).
Compile the Grammar as below:
Window:
set CLASSPATH="C:\downloads\ANTLR\antlr-4.6-complete.jar;"
Linux:
export CLASSPATH=".:/usr/local/lib/antlr-4.6-complete.jar:$CLASSPATH"
Compile using below command:
java org.antlr.v4.Tool -Dlanguage=Python3 -visitor -no-listener grammar.g4
Or
Use antlr plugin available in IDE
Tools:
python version: python 3.6.1
ANTLR version : ANTLRv4
Main file: seawolf.py
Grammar: SeawolfGrammar.g4
Other file:
CustomVisitor.py : overrides default visitor
Rest are auto generated by antlr compiler(Lexer, Parser, .tokens, Visitor etc)
//How to run
python3 main.py input_file