Oxygen Basic
Programming => Bugs & Feature Requests => Topic started by: Peter on March 06, 2011, 11:42:20 AM
-
Deleted
-
Hi Peter,
I put this header code at the top of your first sample. No crashes when invoking ScanBees(). Crashes are most often caused by array boundary errors, Could this be a possibility?
indexbase 0
sys map2[100]
sys xbm,beeras,icx,idx
ibx=10
sys xbee[100],ybee[100],ibee[100],rbee[100]
Charles
PS: AND has a higher precedence level than OR
-
Hi Peter,
I found a precedence bug which I am fairly certain was the cause of the problems you found. Oxygen does not group these together correctly.
if a[2]>10 and a[3]>10 or a[4]>10 then print "yes" else print "no"
but if you supply brackets around the AND clause then it works correctly.
if ( a[2]>10 and a[3]>10 ) or a[4]>10 then print "yes" else print "no"
I have now fixed this problem by making the precedenter more recursive! - The precedenter's duty is to insert brackets into expressions before they are compiled, but it was failing to insert more than one bracket pair when the precedence dropped by more than one level.
thus the precedenter needs to insert 2 opening brackets at the start:
if ( (a[2]>10) and (a[3]>10) ) or (a[4]>10) then print "yes" else print "no"
This correction will be in the next release (A29)
Charles
-
Peter,
A29 should be ready within the next few hours. I have just got the new runtime library working, and need to run a few more tests.
It will save you from bracket hell :)
Charles
-
Hi Peter,
Do you agree with these groupings ;D
if a=a and a==a or a==a and a==a then
'translates to ((a==a)and(a==a))or((a==a)and(a==a))
end if
if a==a*a+a and a*a+a==a or a==a and a==a then
'translates to ((a==((a*a)+a))and(((a*a)+a)==a))or((a==a)and(a==a))
end if
if a==a << a * a + a and a xor a or a
'translates to (((a==a<<((a*a)+a)))and a)xor a)or a
end if
Charles