@rql/parser
v0.1.0
Published
> A Rql parser
Downloads
329
Readme
@rql/parser
A Rql parser
Install
This package is not published yet.
Scripts
yarn build
compile typescript files to .js files and emit type declarationsyarn watch
run compilation whenever a file changes
Example usage
In the web console or in a node-js interpreter you can type:
import {parse} from "@rql/parser"
const ast = parse("Any X WHERE X is Person");
console.log(ast);
It should output the following JSON:
{
"kind": "SearchQuery",
"selection": [
{
"kind": "Variable",
"identifier": {
"kind": "Identifier",
"name": "X"
}
}
],
"restrictions": [
{
"kind": "TripletRestriction",
"subject": {
"kind": "Variable",
"identifier": {
"kind": "Identifier",
"name": "X"
}
},
"relation": {
"kind": "Identifier",
"name": "is"
},
"object": {
"kind": "Identifier",
"name": "Person"
}
}
]
}