An ANTLR grammar for Gremlin would allow us to look at Gremlin as more of a language and to independently consider how that language gets implemented in each variant. By driving the language development through the grammar rather than through Java (as we do now), we can avoid problems where Java-oriented idioms leak into other programming language implementations.
For this initial body of work, the contribution will contain:
- a new gremlin-language maven module
- which will have a ANTLR4 grammar file
- tests for the parser which will extract a corpus of Gremlin traversal from the gherkin tests and the documentation
This initial contribution will have some limitations initially where certain types of statements from the testing corpus are simply not supported by the grammar as it is today. Much of this will have limitation will have to do with examples using Groovy syntax and lambdas, but there are yet places where the grammar needs further development. Those limitations can be satisfied by other pull requests.