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: [email protected]
> > CC: [email protected]
> > 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



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to