A simple logical expression parser to obtain the AST, using Jison.
npm i @jeanbenitez/boolast
OR
AND
()
Parentheses
import { parser } from '@jeanbenitez/boolast';
console.log(parser.parse('REQUIRED OR MANDATORY'));
Output:
{
type: 'OPERATION',
left: {
type: 'LITERAL',
name: 'REQUIRED'
},
op: 'OR',
right: {
type: 'LITERAL',
name: 'MANDATORY'
}
}