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
- Host: GitHub
- URL: https://github.com/exquery/corpusql-parser
- Owner: exquery
- License: bsd-3-clause
- Created: 2016-09-07T13:31:34.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2025-04-30T22:59:34.000Z (about 1 year ago)
- Last Synced: 2025-04-30T23:32:11.139Z (about 1 year ago)
- Language: ANTLR
- Size: 75.2 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Corpus Query Language Parser
============================
[](https://github.com/exquery/corpusql-parser/actions/workflows/ci.yml)
[](http://java.oracle.com)
[](http://opensource.org/licenses/BSD-3-Clause)
[](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