Skip to content

mburbidg/gql-antlr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GQL ANTLR (gql-antlr)

This repository contains a lanuguage-independent ANTLR grammar for Graph Query Language (GQL) based on the August 2023 GQL Specification Draft. It is designed to be included as a submodule in other repositories.

Using the ANTLR tools, language-dependent parsers can be generated by infrastructure code in the parent repository.

GQL Parser for Go is an example of a repository that uses the GQL ANTLR grammar by including this repository as a submodule.

Creation of the ANTLR Grammar File

The original version of the grammar file was generated using gramgen, a command line program that generates an ANTLR parser and lexeer file from an XML representation of the BNF for the GQL grammar. The XML file is an artifact of the official ISO Specification for GQL.

This generated version was then hand tweaked to make it more suitable for ANTLR consumption. Among other changes, mutually left recursive productions were folded into parent productions. The main focus of the changes were related to the value expression and primary value expression productions.

Permissiveness

The Grammar itself is more permissive than a GQL implementation would be. Some type checking and other syntatic analysis would be required as post-processing steps to parsing using the grammar.

Testing and Verification

Not a lot of testing has been done to date, besides spot checking using various hand generated snippets of GQL. In the future this grammar will be validated using a Test Compatibilty Kit (TCK) for GQL.

About

Antlr grammar based on the latest GQL Specification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages