Click here to Skip to main content
13,449,902 members (52,701 online)
Rate this:
Please Sign up or sign in to vote.
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
.. 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 11-Feb-10 2:25am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

(Hope I got you) ANTLR is great at this.
the ANTLR web page [^] has tutorials, reference documentation, sample grammars.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Is there any tutorial or example that you can provide for ANTLR?

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02-2016 | 2.8.180318.3 | Last Updated 11 Feb 2010
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100