Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Playing with the mouse
#11
(12-11-2022, 05:39 PM)TempodiBasic Wrote: wow I  googled and found the order of execution of the logical operator in QB
from first to last: NOT AND OR XOR EQV IMP


is this the same order of execution made by QB64pe? I think so, but I wait for developers response.

If you want our order of operations, check inside the code for my math evaluation routine.  Math Evaluator (qb64phoenix.com)

For our logical operators, they're last in the list and in this order:

Code: (Select All)
 'Logical Operations PL 80+
    i = i + 1: ReDim _Preserve OName(i): OName(i) = "NOT"
    ReDim _Preserve PL(i): PL(i) = 80
    i = i + 1: ReDim _Preserve OName(i): OName(i) = "AND"
    ReDim _Preserve PL(i): PL(i) = 90
    i = i + 1: ReDim _Preserve OName(i): OName(i) = "OR"
    ReDim _Preserve PL(i): PL(i) = 100
    i = i + 1: ReDim _Preserve OName(i): OName(i) = "XOR"
    ReDim _Preserve PL(i): PL(i) = 110
    i = i + 1: ReDim _Preserve OName(i): OName(i) = "EQV"
    ReDim _Preserve PL(i): PL(i) = 120
    i = i + 1: ReDim _Preserve OName(i): OName(i) = "IMP"
    ReDim _Preserve PL(i): PL(i) = 130

So all AND statements will be resolved before OR statements, much like how multiplication is resolved before addition or subtraction.  (PL is Priority Level.  Lower goes first over higher.)

One note though:  NOT is an awfully strange beast.  It's of the highest priority and yet also of the lowest priority.  Unique handling is required when parsing it, as it doesn't truly fit into our order of operations like you'd expect.  It's rather confusing to understand fully, and not worth derailing this topic here with it, but if you're truly interested in how it's parsed, start another topic on NOT somewhere, and I'll refresh my memory and try to explain the PITA that it is for you.  If you're just mildly interested, and don't want a headache from it, just keep in mind, "NOT is a special beast when parsing and order of operations.  Ask more about it if it ever comes up that I need to implement proper evaluation order myself with it."  Wink
Reply


Messages In This Thread
Playing with the mouse - by NasaCow - 12-11-2022, 07:59 AM
RE: Playing with the mouse - by Pete - 12-11-2022, 02:47 PM
RE: Playing with the mouse - by NasaCow - 12-11-2022, 03:03 PM
RE: Playing with the mouse - by SMcNeill - 12-11-2022, 02:51 PM
RE: Playing with the mouse - by TempodiBasic - 12-11-2022, 03:10 PM
RE: Playing with the mouse - by Pete - 12-11-2022, 04:50 PM
RE: Playing with the mouse - by mnrvovrfc - 12-11-2022, 06:36 PM
RE: Playing with the mouse - by Pete - 12-11-2022, 06:39 PM
RE: Playing with the mouse - by TempodiBasic - 12-11-2022, 05:39 PM
RE: Playing with the mouse - by SMcNeill - 12-11-2022, 08:21 PM
RE: Playing with the mouse - by NasaCow - 12-12-2022, 09:38 AM
RE: Playing with the mouse - by TempodiBasic - 12-11-2022, 06:24 PM
RE: Playing with the mouse - by Pete - 12-12-2022, 12:22 AM
RE: Playing with the mouse - by TempodiBasic - 12-13-2022, 02:45 PM



Users browsing this thread: 2 Guest(s)