Author Topic: SmallBASIC is a fast and easy to learn BASIC language interpreter Windows/Linux  (Read 1370 times)

0 Members and 1 Guest are viewing this topic.

Software Santa

  • Administrator
  • *****
  • Posts: 4268
  • OS:
  • Mac OS X 10.9 Mac OS X 10.9
  • Browser:
  • SeaMonkey 2.29.1 SeaMonkey 2.29.1
SmallBASIC is a fast and easy to learn BASIC language interpreter for Windows/Linux/Others

Welcome to SmallBASIC Sat, 12/22/2007 - 05:18 - chrisws SmallBASIC is a fast and easy to learn BASIC language interpreter ideal for everyday calculations, scripts and prototypes. SmallBASIC includes trigonometric, matrices and algebra functions, a built in IDE, a powerful string library, system, sound, and graphic commands along with structured programming syntax.
Constants and Variables
  • Arrays are always dynamic, even if you had declared their size, with dynamic size and type of elements.
However, SmallBASIC uses, internally, 4 data-types
  • Integer  (32bit)
  • Real     (64bit)
  • String   (<32KB on 16bit / 2GB on 32bit)
  • Array    (~2970 elements on 16bit / ~50M elements on 32bit)
Conversions between those types are performed internally. In any case there are functions for the user to do it manually.
Variable namesAbout the dollar-symbol
abc, a_c, _bc, ab2c, abc$ -> valid names 1cd, a$b, $abc            -> invalid names 
This is the default data type. You can declare integers in decimal, hexadecimal, octal and binary form.
x = 256   ' x = 0x100 ' Hexadecimal form 1 x = &h100 ' Hexadecimal form 2 x = 0o400 ' Octal form 1 x = &o400 ' Octal form 2 x = 0b111 ' Binary form 1 x = &b111 ' Binary form 2 
x = .25 x = 1.2 
Strings may be appended to one another using the + operator.
b = "Hello, " + "world!" 
Constant variables can be declared by using the keyword CONST.
CONST my_pi = 3.14 
System Variables
  • OSNAME Operating System name
  • OSVER Operating System Version (0xAABBCC (A=major, B=minor, C=patch))
  • SBVER SmallBASIC Version (0xAABBCC)
  • PI 3.14..
  • XMAX Graphics display, maximum x (width-1)
  • YMAX Graphics display, maximum y (height-1) value
  • BPP Graphics display: bits per pixel (color resolution)
  • VIDADR Video RAM address (only on specific drivers)
  • CWD Current Working Directory
  • COMMAND Command-line parameters
  • TRUE The value 1
  • FALSE The value 0
Sorted by priority
( ) Parenthesis
~ bitwise NOT
NOT or ! Logical NOT  (NOT false = true)
^ Exponentiation
*, /, \ Multiplication, Division, Integer Division
% or MOD Reminder (QB compatible: a=int(a), b=int(b), a-b*(a/b))
MDL Modulus  (a%b+b*(sgn(a)<>sgn(b)))
Addition/Concatenation, Subtraction
= Equal
<> or != Not Equal
>,    < Less Than, Greater Than
=>,   =< Less or Equal, Greater or Equal
>=,   <= Less or Equal, Greater or Equal
AND or && Logical AND
OR  or Logical OR
BAND or & bitwise AND
BOR  or bitwise OR
EQV bitwise EQV
IMP bitwise IMP
XOR bitwise XOR
NAND bitwise NAND
NOR bitwise NOR
XNOR bitwise XNOR
Special Characters
&h or 0x
&o or 0o Prefix for octal constant       (0o33,   &o33)
&b or 0b Prefix for binary constant      (0b1010, &b1110)
[,;] Array definition (function ARRAY)                    ($1)
<< Appends to an array (command APPEND)                   ($1)
++ Increase a value by 1 (x = x + 1)                      ($1)
: Separates commands typed on the same line
& Join code lines (if its the last character of the line). The result line its must not exceed the max. line size.
# Meta-command (if its the first character of the line) or prefix for file handle


Welcome Visitor: