help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question regarding short-circuited operators.


From: Eric Poulsen
Subject: Re: Question regarding short-circuited operators.
Date: Tue, 26 Feb 2002 20:15:18 +0100

Hans,

Thanks for your reply.  I'll check out the comp.compilers group.  As far
as the optimization goes, I'm making more of a run-time evaluated
language than a compiled language.  In fact, it's not even a language;
my goal is simply to parse expression.

Thanks again

-- Eric

On Tue, 2002-02-26 at 04:20, Hans Aberg wrote:
> At 17:07 -0800 2002/02/25, Eric Poulsen wrote:
> >I'm creating an expression parser that supports variables.  Consider
> >this expression:
> >
> >x = 5 || y = 3
> >
> >After evaluating this simple statement, variable 'x' should be 5, and
> >variable 'y' should be undefined, if you take into account
> >short-circuiting of logical operators the way C, and several other
> >languages implement this.
>
> This sounds like a question more suitable to the comp.compilers newsgroup,
> on how to implement various compiler features.
>
> In your example, under C, the compiler can optimize, if you so want,
> finding that x = 5 and y = 3 at compile time. If you have an expression
>   x = a || y = b
> then the compiler can figure out that x = a, but not that what y is, so one
> has to build some kind of closure (runtime code executed later) for that.
>
>   Hans Aberg
>
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]