As a project, over the years, we've often been asked the question as to why
Gremlin doesn't have an ANTLR style grammar. There have been varying
answers over the years to explain the reasoning but in recent years I've
started to see where our dependence on Java for driving Gremlin design has
not translated well as we have expanded Gremlin into other programming
ecosystems. Using Java has often allowed idioms of that language to leak
into Gremlin itself which introduces friction when implemented outside of
the JVM. I think that there is some advantage to designing Gremlin more
with just graphs/usage in mind and then determining how that design choice
looks in each programming language.

I think that using an ANTLR grammar to drive that design work for Gremlin
makes a lot of sense in this context. We would effectively have something
like a gremlin-script which would become the new language archetype. New
steps, language changes, etc. would be discussed in its context and then
implemented in the grammar and later in each programming language we
support in the style a developer would expect. An interesting upside of
this approach is that we can implement gremlin-script in the ScriptEngine
and replace GremlinGroovyScriptEngine which would help us strengthen our
security story in Gremlin Server. Groovy processing would just be a
fallback to Gremlin scripts that could not be processed by the AST. In fact
users who didn't need Groovy could simply not install it at all and thus
boast a much more secure system.

I think that inclusion of a grammar in our project is an exciting new
direction for us to take and will help in a variety of areas beyond those
I've already related.

If we like this direction, Amazon Neptune already maintains such a grammar
and would be willing to contribute it to the project to live in open
source. The contribution would go through the same IP Clearance process
gremlint is going through since it was developed outside of TinkerPop. I'd
be happy to guide that process through if we draw to consensus here.

Reply via email to