[antlr-interest] Number of children

Nazim Oztahtaci nazim_oztahtaci at hotmail.com
Mon Feb 15 03:32:54 PST 2010


Yeah but my task is not evaluate the boolean query. Lets say I have 
something like ((a OR b) AND c) expression. My program should convert it
 to sum of products. so end product will be (a AND c) OR (b AND c) Thats
 why I thought parsing expression to a tree then apply distribution law 
of boolean.

However the example I found creates problem in this 
because lets say I have a NOT expression  inside an expression such as:

(a
 OR b OR c)' AND (d OR e). When I try to apply de-morgan on the tree, 
normally NOT should have been removed to two OR operation but because 
tree ios not ina  good format, it makes wrong conversions.
That is 
why I need that a node have more then tree children so when I apply 
demorgan to


 
 ORNOT /| \
A B  C
 
it
 will be like
  and /| \
A' B'  C'

Date: Mon, 15 Feb 2010 09:53:18 +0100
Subject: Re: [antlr-interest] Number of children
From: bkiers at gmail.com
To: nazim_oztahtaci at hotmail.com; antlr-interest at antlr.org

Why would it pose a problem?

AFAIK,

  OR /| \
A B  C

would evaluate the same as:

    OR
   /  \
  OR   C

 /  \
A    B

No?
Regards,

Bart.


2010/2/15 Nazim Oztahtaci <nazim_oztahtaci at hotmail.com>



Hello,



I have written a grammar based on an example on the Net to parse an expression like (a OR B)AND(C OR D) to a tree like

     AND

OR       OR

A B       C D

It works fine but if expression has more then 2 children, like (A OR B OR C)AND(D OR E OR F)

Then it creates problem because it does something like

AND



D     OR

       E    F

I want it to be like



OR

D  E  F



In other words, a tree node might have capability to have more then 2 nodes as children. How can I set this? I work on C# but couldnt find any setter function in library.

Best regards,

Nazim



_________________________________________________________________

Yeni Windows 7: Size en uygun bilgisayarı bulun. Daha fazla bilgi edinin.

http://windows.microsoft.com/shop



List: http://www.antlr.org/mailman/listinfo/antlr-interest

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


 		 	   		  
_________________________________________________________________
Yeni Windows 7: Gündelik işlerinizi basitleştirin. Size en uygun bilgisayarı bulun.
http://windows.microsoft.com/shop


More information about the antlr-interest mailing list