ysantalla / boolast

A simple logical expression parser to obtain the AST, using Jison

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bool AST

A simple logical expression parser to obtain the AST, using Jison.

Installation

npm i @jeanbenitez/boolast

Supported logical operators

  1. OR
  2. AND
  3. () Parentheses

Usage

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'
  }
}

About

A simple logical expression parser to obtain the AST, using Jison


Languages

Language:JavaScript 100.0%