This project hosts an implementation of a form expression grammar. The grammar is a mashup of spreadsheet-like functions and operators and JMESPath a JSON query language.
Visit the Playground
NOTES:
- Documentation is still in progress. ToDo: Incorporate descriptions of expressions, operators.
- URLs for the playground and documentation are subject to change.
Follow the 'Quick Start' instructions at: https://www.antlr.org/ to install the antlr generator
npm install npm start navigate to http://localhost:8085
Highly recommended to use vscode and install the vscode-antlr4 extension.
[re]generate grammar: source generate.sh
re-save the railroad diagram to the doc folder from vscode:
- Context click on the g4 file
- Choose "Show Railroad Diagram for All Tools
- From the railroad view choose "Save to HTML"
If an expression fails to evaluate, follow these steps to debug:
# populate src/test/debug.txt with the expression to test
> cd antlr
> antlr4 JSONFormula.g4
> javac *.java
> grun JSONFormula formula -tokens -tree ../test/debug.txt
To compare with the jmespath equivalent:
> cd antlr4
> antlr4 jmespath.g4
> javac *.java
> grun jmespath jmesPathExpression -tokens -tree ../test/debug.txt
To run the tests, [re]generation of JavaScript code is a must using the command source generate.sh
npm run test
Contributions are welcomed! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.
To release the package to npm create a commit with the message
Release <version_number>
where the version_number
is the version number in the package.json file.