DBonDB is derived from Dartmouth BASIC, the first BASIC, which was introduced in 1964. Hence the name, "DB or not DB" (that is the question), with the acronym DBonDB.
Is it still BASIC? Is it an example of making a practical language less practical? Or is it an example of putting more effort into the name than the language?
Variables are lower-case a to z. Data-type is string (treated as float by arithmetic operations)
c<text> comment
d; beginning of the data section
e; ends execution (subroutines or data may follow)
g<label>; goes to the label
gs<label>; calls a subroutine at the label
?<var><label>; if var is true (non-zero), goes to the label
else, continues executing the next statement
i<var>; interactive input, assigned to var
l<text>: label - target for gosub, goto or if
s<var><const>; assigns const to var
s<var1><var2>; assigns var2 to var1
+<var><const>; adds const to var and assigns the sum to var
+<var1><var2>; adds var2 to var1 and assigns the difference to var1
- subtracts
* multiplies
/ divides
^ exponentiation
_ concatenates (strings)
pa<code>; prints an acii character - e.g. 9, 10, etc.
ps<string>; prints a literal string (no quotes)
pv<var>; prints a var
r; returns to where the subroutine was called
r0; restores the data pointer to its original location
r<var>; reads the next data item and assigns it to var
Examples
Hello World
psHello, World!;pa10;e;
Factorial
psNumber;in;scn;-c1;l;*nc;-c1;?cl;pvn;pa10;e;
Fibonacci series
psHow many;ic;sa0;sb1;l;sf0;+fa;+fb;pva;pa10;sab;sbf;-c1;?cl;e;
Area of a circle
psRadius;ir;sar;*ar;*a3.14159;pva;pa10;e;
99 Bottles of Beer
sn99;l;pvn;ps bottles of beer on the wall, ;pvn;ps bottles of beer.;pa10;psTake one down, pass it around, ;-n1;pvn;ps bottles of beer on the wall;pa10;?nl;e;
DBonDB console/interpreter for Windows
1. Download dbondb.zip
2. Unzip
3. Run DBornotDB.exe
Type DBonDB code directly at the prompt.
- e.g. psHello World;pa10
Note that individual statements must be separated by semi-colons.
Variables retain their values.
Use the up-arrow to repeat the previous line.
Use 'run' to run example programs.
- e.g. run fibonacci.txt
Use 'cls' to clear the screen.
Use 'bye' to close the console.
- e.g. bye