I am designing a rule engine in which the data resides in database in an expression format which is shown below. We are required to evaluate the expression in an order. If there is no "NOT" beside the option means we need to append "EQ" (equal). Since we need to execute in "AND","OR" order, we have to evaluate expression in the right format EX:
#1
Expression: NOT S:24zoll_1757 AND C:1757 AND C:1780 Conversion: (NOT S:24zoll_1757) AND (EQ C:1757) AND (EQ C:1780)
#2
Expression: (S:gr1_1778 OR S:gr2_1778 OR S:gr5_1778) Conversion: ((EQ S:gr1_1778) OR (EQ S:gr2_1778) OR (EQ S:gr5_1778))
#3:
Expression: S:25zoll_1757 AND S:ber7_1756 Conversion: (EQ S:25zoll_1757) AND (EQ S:ber7_1756)
#4:
Expression: S:25zoll_1757 AND NOT S:ber7_1756 Conversion: (EQ S:25zoll_1757) AND (NOT S:ber7_1756)
#5:
Expression: S:25zoll_1757 AND (NOT S:ber7_1756 OR S:ber8_1756) Conversion: (EQ S:25zoll_1757) AND ( (NOT S:ber7_1756) OR (EQ S:ber8_1756) )
I have tried using Stack but it is working up to some extend. We have very complicated long statement which is not working.
Any ideas much appreciated?