This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: HELP!: pointers on unsing expr: A.evaluate() && B.evaluate() || c.evaluate()
- To: Arman Anwar <aaanwar at yahoo dot com>
- Subject: Re: HELP!: pointers on unsing expr: A.evaluate() && B.evaluate() || c.evaluate()
- From: Per Bothner <per at bothner dot com>
- Date: 08 Jul 2000 23:00:20 -0700
- Cc: kawa at sourceware dot cygnus dot com
- References: <20000709012211.12377.qmail@web119.yahoomail.com>
Arman Anwar <aaanwar@yahoo.com> writes:
> I need to implement an expression compiler that will copile boolean
> expressions into byte code.
If you haven't already, you should read the internals document:
http://www.gnu.org/software/kawa/internals.html
(Some of it is a little out of date, but most of it is still current.)
To implement (A && B) you can represent this as (A ? B : false),
which is represented using a gnu.expr.IfExp instance.
The Scheme compiler uses kawa.standard.and_or to translate the
Scheme (or A B). It could use it for (and A B).
> Or we could have methids that need to be evaluated on certain objects. For
> simplicities sake let us say all concerned objects implement the evaluate()
> method which returns a boolean result thus I would like to compile:
> A.evaluate() && B.evaluate().
All Expression objects implement the eval method. However,
non-trivial expressions are compiled, so it is more important that
they implement the compile method.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/