Welcome to the Rule Engine Documentation

Our Rule Engine utilizes Abstract Syntax Tree (AST) for efficient rule evaluation and visualization. Below are the key functionalities we offer.

What is AST?

An Abstract Syntax Tree (AST) is a tree representation of the abstract syntactic structure of source code. Each node of the tree denotes a construct occurring in the source code. The AST abstracts the structure of the code, making it easier to analyze and manipulate.

Why is AST Used? ASTs are commonly used in compilers and interpreters, allowing for efficient parsing, analyzing, and transforming source code. They provide a way to understand the underlying structure of code, enabling various optimizations and analyses.

How Can Users Benefit from AST? In our Rule Engine, ASTs allow users to define complex rules in a structured way. Users can combine simple rules into more complex conditions, visualize these rules for better understanding, and efficiently evaluate them against user data.

Key Functionalities

Set and Evaluate Rules

Input custom rules and receive instant evaluation with high precision.

Visualize Rules

Visualize complex rules with our intuitive syntax tree displays.

Combine Rules

Consolidate multiple rules with ease, enhancing system compatibility.

Instructions and Examples

Input Guidelines:

  • Use capital letters for keywords: AND, OR
  • Use parentheses () to group expressions
  • No need to add quotes around strings, e.g., department == Sales
  • Ensure valid JSON structure for input data.

Examples:

1. Rule: age > 30

User Data:


// Sample User Data
{
  "users": [
    { "age": 32, "department": "Sales", "salary": 60000, "experience": 6 },
    { "age": 28, "department": "HR", "salary": 45000, "experience": 4 }
  ]
}
                  

2. Rule: department == Sales

User Data:


// Sample User Data
{
  "users": [
    { "age": 35, "department": "Sales", "salary": 55000, "experience": 5 },
    { "age": 40, "department": "Marketing", "salary": 50000, "experience": 7 }
  ]
}
                  

3. Rule: ((age > 30 AND department == Sales) OR (age < 25 AND department == Marketing)) AND (salary > 50000 OR experience > 5)

User Data:


// Sample User Data
{
  "users": [
    { "age": 32, "department": "Sales", "salary": 60000, "experience": 6 },
    { "age": 22, "department": "Marketing", "salary": 30000, "experience": 3 }
  ]
}
                  

4. Rule: ((age > 30 AND department == Marketing)) AND (salary > 20000 OR experience > 5)

User Data:


// Sample User Data
{
  "users": [
    { "age": 35, "department": "Marketing", "salary": 25000, "experience": 5 },
    { "age": 29, "department": "Sales", "salary": 15000, "experience": 2 }
  ]
}