Upgrade grammar to ANTLR4


The AQL grammar is now ANTLR3, but there are a number of other variants (vendor defined grammars) in ANTLR4.
Our published grammar needs to be upgraded to latest format - ANTLR4 (which is allegedly cleaner, easier) and synchronized as much as possible with these other circulating variants.


Pieter Bos
November 11, 2020, 8:40 PM

A clean ANTLR4 grammar matching exactly the current ANTLR grammar is at . In the comments at the top it lists what it does not support that is already in the text of the standard, but not yet in the standard grammar. Feel free to use it.

Pieter Bos
February 9, 2021, 12:51 AM

About the URI-rule in the lexer:

It is possible that some other valid parts of the syntax are matched as a URI, as this URI-rule matches all valid URIs, and that is a quite extensive set. I remember I removed one form of URIs that just would cause too much trouble if left in, but I have never seen that particular form of URI used in practice, ever. I would have to check with the specification to find if I really did that, and what it was.

if this does indeed clash with a different lexer rule, it looks like this can be solved by exploiting the fact that these URIs only occur between ‘{' and '}'-characters in AQL. In that case, it can be moved to the lexer, just like the CONTAINED_REGEX rule does with regular expressions.

Pieter Bos
4 days ago

I spoke with Teun van Hemert, who helped to write this grammar, and he started testing it. He noticed there will be some fixes required int he lexer - as I expected. So there will be some changes here before the grammar is entirely correct. Still, as an initial version, I consider this a good change, just we will have to update the grammar again before we get a good version that corresponds entirely with the specification.

Bjørn Næss

We are not using the ANTLR based grammar. Still I support this.


Sebastian Iancu

Raised By

Sebastian Iancu


Affects versions