Open TillS opened 11 years ago
Consider the rule " !( !node1 && node2)", what should be the arrow type for node1 ? Also should the arrow be the same if && is replaced by || ?
The syntax parser is pretty simple currently. It has been made using regex. To accommodate features like above a proper parser is needed which constructs a tree representation of the rule.
We should argue following the two deMorgan laws for Boolean algebra:
(De Morgan 1) (¬x)∧(¬y) = ¬(x∨y) (De Morgan 2) (¬x)∨(¬y) = ¬(x∧y)
Thus, for && and || it works in the same way for the arrow type alone. Your example !( !node1 && node2 ) should translate in a positive arrow head for node 1 and a negative for node 2. Same if it was || instead of &&. If someone could implement that, that would be awesome! Cheers
As Matthias and I understand, the syntax parser will be a lot of work. However, in my opinion, if we really want to design a functional tool that can translate the rules, this kind of parser is definitely necessary. The only other option to think about would be to translate all the rules into the simplified rules first using the Boolean algebra, i.e. commutativity, associativity, deMorgan etc. and then apply the regex parser that you already have and that can handle the simplified representation of the rules. What is your opinion on this subject, Chaitanya? Cheers
Constructing a better parser is indeed a lot of work. It will require constructing ASTs for every rule, similar to the approach that Till has suggested. If a good js library that implements such functionality is found, it would greatly simplify the solution.
If "!" in front of parentheses in the imported file or in the rules tab, it is not translated as an inhibition in the network view