This involves algebraic rewrites; you want to extend an algebraic normal form (see wikipedia article) to include exponentiation and express division in terms of negative exponents and compare formulae after conversion to normal form. And you probably want to do constant folding (another wikipedia article) while you are at it.
--Loring ----- Original Message ---- > From: Jon Svede <[email protected]> > To: [email protected] > Sent: Tue, September 14, 2010 12:29:28 PM > Subject: [antlr-interest] comparing two parse trees > > Hi, > > I am new to ANTLR. > > I want to be able to compare formulas to see if the are the same formula, >something like the following: > > (A + B / C)^D > > Compared to > > (W+X)/Y^Z > > I don't particularly care about the actual terms of the equations (well, not >right now anyway), I just want to know if they are structurally the same. > > Can anyone point me in the right direction as far as docs that talk about >this? Is this covered in the book "The Definitive Guide to ANTLR"? I don't >recall reading anything about this(or maybe I missed it?)... > > Thanks in advance for any assistance! > > Sincerely, > > Jon > > > > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: >http://www.antlr.org/mailman/options/antlr-interest/your-email-address > 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.
