OxygenBasic: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "{{language}} 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...")
 
No edit summary
Line 7: Line 7:


'''Hello World:'''
'''Hello World:'''
<pre>
print "Hello World!"
</pre>


'''Iteration:'''
<nowiki>print "Hello World!"
</nowiki>
<pre>
i=0

Iteration:
<nowiki>i=0
pr=""
pr=""
for i=1 to 10
for i=1 to 10
pr+="Line: " i
pr+="Line: " i chr(13) chr(10)
next
next
print pr
print pr
</nowiki>
</pre>


'''Function:'''
'''Function:'''
<pre>

function cube(double n) as double
function cube(double n) as double
return d*d*d
return d*d*d
Line 27: Line 28:


print cube(3)
print cube(3)
</pre>



'''Class:'''
'''Class:'''
<pre>

<nowiki>class MemoryBank
class MemoryBank
'
'
string buf
string buf
Line 55: Line 56:


MemoryBank b
MemoryBank b
b.store "
b.store ("
shoes LC1
shoes LC1
ships LC2
ships LC2
sealing wax LC3
sealing wax LC3
cabbages LC4
cabbages LC4
kings
kings LC5
"
")


print b.find "ships"
print b.find "ships"
</nowiki>
</pre>


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.
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.

Revision as of 11:20, 19 June 2012

Language
OxygenBasic
This programming language may be used to instruct a computer to perform a task.
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.


Hello World:

print "Hello World!"

Iteration:

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

Function:

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

print cube(3)

Class:

class MemoryBank
  '
  string buf
  '
  method store(string s)
    buf += " " s chr(13)
  end method
  '
  method find(string s) as string
    sys a,b
    a=instr buf,s
    if a then
      b=instr a,s,chr(13)
      return mid buf,a,b-a
    end if
  end method
  '
  method clear()
    buf=""
  end method
  '
end class

MemoryBank b
b.store ("
shoes LC1
ships LC2
sealing wax LC3
cabbages LC4
kings LC5
")

print b.find "ships"

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.

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

http://www.oxygenbasic.org

--Charles Pegge 11:03, 19 June 2012 (UTC)