Experimental machine-verifiable ADQL grammar

Jon Juaristi Campillo juaristi at uni-heidelberg.de
Fri May 10 13:16:34 CEST 2019


Dear DAL members,

In order to have a machine-verifiable version of the ADQL grammar 
(including the lexing phase), part of the GAVO/ARI team (myself and 
Markus Demleitner) have implemented an experimental version of it using 
Parsing Expression Grammar or PEG.

It has been added to the lyonetia project 
[https://github.com/ivoa/lyonetia] maintained by Dave Morris. Our 
development is located on `src/peg` 
[https://github.com/ivoa/lyonetia/tree/master/src/peg]. We strongly 
recommend to read the README file (also appended below).

It passes all examples that are part of lyonetia -- where we found (and 
fixed) a couple of small errors. We have added additional tests too. 
Nevertheless, it certainly needs a bit of work yet.

Any feedback in the form of ideas, pull requests, etc. is welcome. I 
will hold a talk about this in the Paris Interop meeting as part of the 
DAL sessions.

Best regards,
Jon Juaristi on behalf of GAVO/ARI team.

--README file:

This directory contains an experimental PEG grammar for ADQL, largely
derived from the published BNF grammar.

Caveats:

* We hope the syntax is portable PEG.  For our reference implementation,
   which is based on arpeggio, we employ some lightweight translation
   into this library's PEG dialect.
* We're using a custom arpeggio feature for case folding.  The grammar
   would be too ugly without it.
* We're using negative lookhead, which is a (common) extension to
   classic PEG.

Trying it out:

This directory contains the testpeg.py script that, when started here,
will run all example queries collected under adql.  It will report
both false positives and false negatives.

As said above, you'll need arpeggio for that; see
https://pypi.org/project/Arpeggio/

More on PEG:

Paper defining the thing: https://dl.acm.org/citation.cfm?id=964001.964011
or, free, http://bford.info/pub/lang/peg

Link list maintained by the inventor: http://bford.info/packrat/

For this particular attempt we're using arpeggio,
http://textx.github.io/Arpeggio/stable/; we'll have to see how
portable the resulting PEG is; in particular.

Syntax rules for an alternative PEG machinery:
https://relishapp.com/jarhart/rattler/docs/peg-syntax

-- 
Jon Juaristi Campillo            web:  http://gaia.ari.uni-heidelberg.de
Astronomisches Rechen-Institut   mail: juaristi at uni-heidelberg.de
Moenchhofstrasse 12-14           tel:  +49 6221 54-1849
69120 Heidelberg, Germany        fax:  +49 6221 54-1888


More information about the dal mailing list