An open API service indexing awesome lists of open source software.

https://github.com/exquery/corpusql-parser

Corpus Query Language Parser
https://github.com/exquery/corpusql-parser

Last synced: 5 months ago
JSON representation

Corpus Query Language Parser

Awesome Lists containing this project

README

          

Corpus Query Language Parser
============================
[![Build Status](https://github.com/exquery/corpusql-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/exquery/corpusql-parser/actions/workflows/ci.yml)
[![Java 8+](https://img.shields.io/badge/java-8+-4c7e9f.svg)](http://java.oracle.com)
[![License](https://img.shields.io/badge/license-BSD-blue.svg)](http://opensource.org/licenses/BSD-3-Clause)
[![Maven Central](https://img.shields.io/maven-central/v/com.evolvedbinary.cql/corpusql-parser?logo=apachemaven&label=maven+central&color=green)](https://search.maven.org/search?q=g:com.evolvedbinary.cql)

This library implements a Corpus Query Language Parser in Java 1.8, using [Antlr v4](http://www.antlr.org/).

As no official Corpus Query Language specification is available, the gramar definition for this parser was derived from running `jjdoc` against the javacc [`cql`](https://raw.githubusercontent.com/INL/BlackLab/master/core/src/main/javacc/nl/inl/blacklab/queryParser/corpusql/cql.jj) grammar from the [Institute of Dutch Lexicology](http://www.inl.nl/) [BlackLab](https://github.com/INL/BlackLab) project.

The parser generates an AST (Abstract Syntax Tree) which you can then use in your own application for whatever you wish. The class [Main](https://github.com/exquery/corpusql-parser/blob/master/src/main/java/com/evolvedbinary/cql/parser/Main.java) shows how the parser can be used. You can also execute `Main` as an application if you want to understand the node-tree produced by the parser.

Obtaining
---------
The [compiled artifact](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.evolvedbinary.cql%22%20AND%20a%3A%22corpusql-parser%22) can be obtained from Maven Central by adding the following to the `` section of your `pom.xml`:
```xml

com.evolvedbinary.cql
corpusql-parser
1.3.0-SNAPSHOT

```

If you are a Scala, Groovy or Clojure person then you can still use the artifact from Maven Central with your favourite build tool, however I will assume you know what you're doing ;-)

Example
-------
An example of this parser being used in another application is the [Corpus Query Language Module for eXist-db](https://github.com/bcdh/cql-module); Which shows how to traverse the AST for a custom application, in this specific case generating an XML vocabulary of Corpus Query Language.

Future Work
-----------
* Provide some tutorials or better documentation