Click here to Skip to main content
15,887,861 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I am working on an algorithm and perhaps an implementation in C++/c# for logical expressions. I want this logical expression for example, k = ((((a+b)'c)+((d+e)'f))g. My task is to put this expression in a short DNF / Sum of Products form such as abc'+bdf'+.... To do this I planned to put the expression in a tree like :
.
| |
+ g
|
Not.
..
..
.. and so on. Then I will apply de-morgan rule and at the last step Distribution law of multiplication over +. However I am facing problems about implementation. During my research many people are using Linq.Expression system classes or some articles are about Evaluant.Anltr framework to create tree. I want to indicate that I do not want to evaluate the logical expression. I just want to have Sum of Products form. Is there anyone who did similar thing so can give me some hints? Perhaps I dont expect a source code or smt but at least it will be nice to get some tips or guidence to create a hierarchic tree
Best regards
Posted

(Hope I got you) ANTLR is great at this.
the ANTLR web page [^] has tutorials, reference documentation, sample grammars.
:)
 
Share this answer
 
v3
Is there any tutorial or example that you can provide for ANTLR?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900