|Subject:||Re: Operator precedence
|Date:||Wed, 6 Sep 2017 22:54:38 +0100
|From:||Michael Kennedy <Info@KennedySoftware.ie>
Wow - that's real nasty! But you seem to have resolved it.
Back, maybe 20-25 years ago, I recall writing an expression-evaluator
from scratch, and I still recall major hassle with that damn "-" and
with "NOT" - probably the same issue with both. I don't remember the
details, nor good examples, but maybe something like:
A * -B --> A * (-B) --> A * (0-B)
So the meaning of each "-" had to be determined first, before deciding
how/when to evaluate it.
Maybe the same approach was/is needed for NOT?
On 06/09/2017 18:56, Bernie van't Hof wrote:
> Thanks, Mike.
> What I realised in the mean-time ..
> php has precedence of ! (NOT) above all those on your list except ()
> IF NOT Retval = "Esc" ; which works fine
> does not become
> if( ! $Retval == 'Esc') // valid php but wrong result!
> it should be
> if( ! ($Retval == 'Esc'))
> I used the above pal construct only twice in 30k lines of pal, more
> commonly using
> IF Retval <> "Esc"
> which converts nicely to
> if($Retval <> 'Esc')
> so I didn't spot it in earlier run-time testing.
> On 7/9/17 2:10 am, Michael Kennedy wrote:
>> The manuals say:
>> () - Inner pairs first
>> (All the following are Left-to-Right]...
>> * /
>> + -
>> = <> < <= > >=
>> ...all as expected...
>> There's no mention of that darn "unary minus", nor of different
>> contexts of "NOT", etc...
>> I assume that PDoxDOS represents (1=2), [False], internally as 0, but
>> I don't recall how it represents (1=1) [True, = NOT False]. I think
>> most systems use "-1", but some systems use just "1", and maybe some
>> use "any non-zero value"?.....
>> - Mike
>> On 04/09/2017 18:40, Bernie van't Hof wrote:
>>> Anyone have handy a operator precedence list for PDOX DOS?
>>> Having an issue with 'NOT' and darned if I can see why.