@Override
    public Object eval(final String script, final ScriptContext context) throws ScriptException {
        final Object o = context.getAttribute("g");
        if (!(o instanceof GraphTraversalSource))
            throw new IllegalArgumentException("g is of type " + o.getClass().getSimpleName() + " and is not an instance of TraversalSource");

        final Map<String, Object> m = context.getBindings(ScriptContext.ENGINE_SCOPE);
        final GremlinAntlrToJava antlr = new GremlinAntlrToJava((GraphTraversalSource) o,
                variableResolverMaker.apply(m));

        try {
            return GremlinQueryParser.parse(script, antlr);
        } catch (Exception ex) {
            throw new ScriptException(ex);
        }
    }
Gremlin scripts evaluated by the grammar must be bound to "g" and should evaluate to a "g" in the
{@code ScriptContext} that is of type {@link TraversalSource}
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinLangScriptEngine.java