[antlr-interest] comparing two parse trees
Loring Craymer
lgcraymer at yahoo.com
Tue Sep 14 13:01:24 PDT 2010
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 <jsvede at yahoo.com>
> To: antlr-interest at antlr.org
> 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
>
More information about the antlr-interest
mailing list