[antlr-interest] Factorization of Logic Expressions

Nazim Oztahtaci nazim_oztahtaci at hotmail.com
Thu Mar 18 00:56:04 PDT 2010


hi,

I guess my point is misunderstood. for example, my output is smt like abc+abd and this is the only information I save on a text file. Later on I will read this string, no more information I know about original diagram or what I did for DNF transformation. My program reads this string and factorize it to ab(c+d). I need to read all minterms, make some calculations(either in a matrix or there can be co-graphs maybe).I dont think I can use Antlr because I cant define this in a grammar, at least on my mind.
Maybe I have misunderstood your point. In the way you try to describe, StringTemplate, how could you factorize an expression like ab+acd+ace to a(b+c(d+e)). You know nothing about "a(b+c(d+e))" in the beginning.

> Subject: Re: [antlr-interest] Factorization of Logic Expressions
> From: jbb at acm.org
> To: nazim_oztahtaci at hotmail.com
> CC: newsreply at areeda.com; antlr-interest at antlr.org
> Date: Wed, 17 Mar 2010 17:58:25 -0400
> 
> Greetings!
> On Wed, 2010-03-17 at 20:43 +0000, Nazim Oztahtaci wrote:
> > Hello,
> > actually this was my first point for the project group. but they want a compressed small string. 
> > that's why I am only able to read SoP form and try to reach the original version. or at leasy I
> >  should find a simplfied or factorized version.
> 
> This is probably a really stupid suggestion, but have you tried the
> toStringTree() method on your transformed AST? (altho this is likely to
> print a polish prefix-like form...)
> 
> or maybe look into using StringTemplate, it is supposed to be built to
> support this kind of thing....
> 
> or perhaps appropriate print statements within actions in a Tree Walking
> grammar... (well i guess i really mean toString-like actions in child
> rules, accumulate and glue together the children's strings and print
> from the top-level rule, but i think this is the essence of using
> StringTemplate)
> 
> > 
> > > Date: Wed, 17 Mar 2010 10:26:35 -0700
> > > From: newsreply at areeda.com
> > > CC: antlr-interest at antlr.org
> > > Subject: Re: [antlr-interest] Factorization of Logic Expressions
> > > 
> > > This might be a bit simplistic, but why not save the original expression
> > > as a string?  Then you could compare that with your processed version.
> > > 
> > > Joe
> > > 
> > > Nazim Oztahtaci wrote:
> > > > Hello everyone,
> > > > I would like to thank everyone first of all during their help when I became a new member to this group. I am working on Antlr and my task since last month. I am able to parse a logic expression such as a(b+c) into a tree, then I apply Demorgan and distribution so I reach a DNF representation: ab+ac.. The operators that I support are NOT, OR, AND, >, <. Timer and IF-ELSE statements. 
> > > > Now Im working on factorizing the DNF formed expressions back to originial because the user of my program will be able to read output data file which has only string representation of DNF expression. So I need to factorize the DNF expression. The way I try to do is putting the expression in a matrix such as
> > > >  a b c
> > > >  1 1 X  ab
> > > >  1 X 1  ac
> > > >
> > > > Then reading this matrix to find the most number of 1s and then re-check these rows if there are any more subsequences and so on.. I know that I cant reach the original expression everytime for the complicated expressions. Also for the reverse Demorgan, I cant use this matrix probably. I wanted to ask users of this mail group if they have any advice to me regarding an algorithm for this problem or a new way as solution.
> > > >
> > > > I know it is a bit hard and rare problem so even no help will be available for me, I appreciate for previous helps as well.
> > > >
> > > > Thank you all and good luck everyonje with their studies
> > > > Nazim
> > > >  		 	   		  
> 
> Hope this helps....
>    -jbb
> 
> 
 		 	   		  
_________________________________________________________________
Windows Live Hotmail: Arkadaşlarınız Facebook'taki güncellemelerinizi doğrudan Hotmail®'den alır.
http://www.microsoft.com/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:tr-tr:SI_SB_4:092009


More information about the antlr-interest mailing list