What is the best way to get closer to checking the rules?

So, currently I work as an intern in the company and I am tasked with creating a mid-level layer of the user interface rules editor for the analytical mechanism. As part of this task, I guarantee that all created rules are the correct rules. These rules can be quite complex, consisting of 10 fields with several possibilities for each field.

I am here above my head, I tried to find material that could help me in this task, but I can not find much. Is there any approach to a template or design that I can take to break it down into more manageable tasks? Book to read? Any ideas or recommendations will be appreciated.

+4
source share
2 answers

You can spend time learning lexer / parser, for example. Anltr4. You can use Antlrwork2 ide for visualization and debugging.

Antlrworks2: http://tunnelvisionlabs.com/products/demo/antlrworks

You can get off the ground by searching for grammars, for example, and then tweaking them for your specific needs.

Grammars: https://github.com/antlr/grammars-v4

Antlr provides output bindings in several languages ​​- so you will probably have one that suits you.

In any case, this is not a trivial task, but interesting and useful.

0
source

You need to build an algorithm for the same.

Points to be observed

1.) Verification of parameters based on data type support and compatibility. 2.) Which operator should be followed by the operand of a particular data type. 3.) The result of returning some expression must again be compatible with the next operand or operator.

Give the opportunity to simulate a rule where the user can select the dataset by which the rule should be run.

eg,

a + b > c 

Possible combinations.

1.) A, b can be a string, a number, or an integer. 2.) But the combination result a + b, if String, then the ">" operator cannot come.

0
source

Source: https://habr.com/ru/post/1497447/


All Articles