This example project contains an ANTLRv4 grammar file (see AccessExpression.g4) that can be used to create AccessExpression parsers in languages supported by ANTLRv4. For example, a project could use this to validate that AccessExpression's are valid before sending them to Accumulo in the ColumnVisibility field of the Key.
An example parser and evaluator are used when building this project to confirm that the parsing and evaluation are consistent with the reference Java implementation.
ANTLR was evaluated as a replacement for the existing custom Java parser, but it doesn't parse as fast as the custom implementation. You can view the performance differences by running the JMH benchmark in this antlr4-example project and the one in the main project.
To run the benchmark in this project, first build the main project using:
mvn clean install
Then, switch to the cloned directory for this example, and run the benchmark command:
cd target/its/antlr4-example/ mvn exec:exec -Dexec.executable="java" -Dexec.classpathScope=test -Dexec.args="-classpath %classpath org.apache.accumulo.access.grammar.antlr.AccessExpressionAntlrBenchmark"