We parse CQP:s in the frontend in order to merge global filters (e.g. party filter for the vivill corpus), check for compatible features (free order) and to convert Korp-specific operators (&= etc). We implement this using PEG.js.
The TEITOK tool also does CQP (CQL) parsing using PEG.js. The main source code only includes the compiled PEG.js output but the PEG.js source code is also available in a separate repo.
It should be useful to examine similarities and differences. Perhaps they can be merged; both Korp and TEITOK could benefit from sharing a parsing library. And/or we could be helped by the cql_highlight.pegjs grammar which is supposed to yield HTML for syntax highlighting.
We parse CQP:s in the frontend in order to merge global filters (e.g. party filter for the
vivill
corpus), check for compatible features (free order) and to convert Korp-specific operators (&=
etc). We implement this using PEG.js.The TEITOK tool also does CQP (CQL) parsing using PEG.js. The main source code only includes the compiled PEG.js output but the PEG.js source code is also available in a separate repo.
It should be useful to examine similarities and differences. Perhaps they can be merged; both Korp and TEITOK could benefit from sharing a parsing library. And/or we could be helped by the
cql_highlight.pegjs
grammar which is supposed to yield HTML for syntax highlighting.