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 test page here
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
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 ../src/test/debug.txt
To compare with the jmespath equivalent:
> cd antlr4
> antlr4 jmespath.g4
> javac *.java
> grun jmespath jmesPathExpression -tokens -tree ../src/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.
Available functions defined here