This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: HELP!: pointers on unsing expr: A.evaluate() && B.evaluate() || c.evaluate()


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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]