Category:OxygenBasic: Difference between revisions

From Rosetta Code
Content added Content deleted
m (Added link to official site)
 
Line 14: Line 14:
'''Iteration:'''
'''Iteration:'''
<pre>
<pre>
int i
i=0
string pr
pr=""
for i=1 to 10
for i=1 to 10
pr+="Line: " i chr(13) chr(10)
pr+="Line: " i chr(13,10)
next
next
print pr
print pr
Line 24: Line 24:
'''Function:'''
'''Function:'''
<pre>
<pre>
function cube(double n) as double
function cube(double d) as double
return d*d*d
return d*d*d
end function
end function
Line 37: Line 37:
string buf
string buf
'
'
method store(string s)
method store(string key,text)
buf += " " s chr(13)
buf += chr(1) + key + chr(2) + text + chr(3) + chr(13)

end method
end method
'
'
method find(string s) as string
method find(string key) as string
sys a,b
int a,b,c
a=instr buf,s
a=instr 1,buf,chr(1) + key '+ chr(2)
if a then
if a then
b=instr a,s,chr(13)
b=instr a, buf, chr(2)
return mid buf,a,b-a
c=instr a, buf, chr(3)
return mid buf, b+1, c-b-1
end if
end if
return "( "+key+ " not found )"
end method
end method
'
'
Line 57: Line 60:


MemoryBank b
MemoryBank b
b.store ("
b.store "shoes","500 pairs"
b.store "ships","10 galleons"
shoes LC1
b.store "sealing wax","5 lbs"
ships LC2
sealing wax LC3
cabbages LC4
kings LC5
")


print b.find "ships"
string f=b.find("ships")
</pre>
</pre>



Latest revision as of 13:56, 4 March 2022

Language
OxygenBasic
This programming language may be used to instruct a computer to perform a task.
Official website
Type expression: Implicit, Explicit
See Also:


Listed below are all of the tasks on Rosetta Code which have been solved using OxygenBasic.

OxygenBasic is a compilable language in the BASIC genre supporting object-oriented programming, and containing features of C. Its earliest origins was as a macro Assembly code language in 2009, but subsequently acquired all the features of a high-level language.

The philosophy underlying OxygenBasic is to facilitate clean coding, with low syntax noise and few coding restrictions. The core language and compiler size are kept to a minimum.

Examples

Hello World:

print "Hello World!"

Iteration:

int i
string pr
for i=1 to 10
  pr+="Line: " i chr(13,10)
next
print pr

Function:

function cube(double d) as double
  return d*d*d
end function

print cube(3)

Class:

class MemoryBank
  '
  string buf
  '
  method store(string key,text)
    buf += chr(1) + key + chr(2) + text + chr(3) + chr(13)

  end method
  '
  method find(string key) as string
    int a,b,c
    a=instr 1,buf,chr(1) + key '+ chr(2)
    if a then
      b=instr a, buf, chr(2)
      c=instr a, buf, chr(3)
      return mid buf, b+1, c-b-1
    end if
    return "( "+key+ " not found )"
  end method
  '
  method clear()
    buf=""
  end method
  '
end class

MemoryBank b
b.store "shoes","500 pairs"
b.store "ships","10 galleons"
b.store "sealing wax","5 lbs"

string f=b.find("ships")

Current Status

The current implementation is available for Microsoft Windows and includes an x86 assembler. It can compile directly to memory, or to 32 bit and 64 bit binaries. Development is currently in Alpha phase. The compiler is a single DLL, and suitable for embedding in other Applications. It has been deployed as a module in thinBasic to support Assembly code and dynamic compiling.

The latest versions can be obtained here, including an IDE and numerous examples:

Pages in category "OxygenBasic"

The following 90 pages are in this category, out of 90 total.