========================== A reimplementation of Sigma using the ANTLR parser and storing formulas in an abstract syntax tree
========================== The parser folder is generated from antlr and examples of usage of this project is down below. The .g4 files Suokif and Tptp are both implementation of Sigma to generate the parser folder.
==========================
If on a Mac, install homebrew (if wget not already installed from homebrew)
brew install wget
First we need to get the antlr jar and we will do this by using wget. We will also be setting the alias for antlr.
wget http://www.antlr.org/download/antlr-4.7-complete.jar
alias antlr='java -jar $PWD/antlr-4.7-complete.jar'
==========================
We will be inputting a string and they will be parsed as tokens within antlr to be created an Abstract Syntax Tree
cd /home/user/workspace/sigmaAntlr/src/java/com/articulate/sigma/parsing
java -Xmx500M -cp antlr-4.8-complete.jar:$CLASSPATH org.antlr.v4.Tool
-package com.articulate.sigma.parsing /home/user/workspace/sigmaAntlr/Suokif.g4
If you want to compile the grammar manually rather than running ant
javac -classpath ".:antlr-4.8-complete.jar" Suokif*.java
java -classpath ".:antlr-4.8-complete.jar" org.antlr.v4.gui.TestRig Suokif file -tokens -gui
========================== There's an ANTLR grammar for TPTP that also can be used
antlr4 -package tptp_parser Tptp.g4
formula_test_1 row_pred_var_test_1
========================== Apache 2.0 License