A FEEL parser and interpreter
npm install feelin
A DMN FEEL parser and interpreter written in JavaScript. __:arrow_right: Try it out__.
``javascript
import {
unaryTest,
evaluate
} from 'feelin';
unaryTest('1', { '?': 1 }); // { value: true, warnings: [] }
unaryTest('[1..end]', { '?': 1, end: 10 }); // { value: true, warnings: [] }
evaluate("Mike's daughter.name", {
'Mike\'s daughter.name': 'Lisa'
}); // { value: 'Lisa', warnings: [] }
evaluate('for a in [1, 2, 3] return a * 2'); // { value: [ 2, 4, 6 ], ... }
evaluate('every rate in rates() satisfies rate < 10', {
rates() {
return [ 10, 20 ];
}
}); // { value: false, warnings: [] }
`
To understand null conversions due to errors, inspect warnings returned:
`javascript
const { value, warnings } = evaluate('x');
console.log(warnings);
// [
// {
// message: "Variable 'x' not found",
// type: 'NO_VARIABLE_FOUND',
// position: { from: 0, to: 1 },
// }
// ]
`
* [x] Recognizes full FEEL grammar
* [x] Context sensitive (incl. names with spaces)
* [x] Recovers on errors
* [x] Temporal types and operations
* [x] Built-in FEEL functions
* [ ] Full DMN TCK compliance (cf. coverage)
`shbuild the library and run all tests
npm run all
* lezer-feel - FEEL language definition for the Lezer parser system
* feel-playground - Interactive playground to learn the FEEL language
MIT