BASIC in JB

Programming Tools, Tips, and Tutorials.
NJames
Posts: 43
Joined: Tue Jul 14, 2009 2:55 pm

BASIC in JB

Post by NJames »

This is a project I'm working on to implement BASIC inside Just BASIC.

Third posted version introduces "parent/child variables." A child variable is defined as an expression and can be based on another variable. A change to the parent variable is seen in the child variable also.

This version includes some LiveBASIC programs to demonstrate the language. Inside LiveBASIC you can type "load" to bring up an open file menu.

"parentchild.txt" is the program that demonstrates how to use the child variables.

"HELLO.txt" demonstrates how a classic BASIC program can be implemented in LiveBASIC.

"number guesser.txt" demonstrates LiveBASIC's implementation of "random" numbers.

All words must be separated by spaces. Expressions should have each term separated, like 1 + 1 = 2, NOT 1+1=2.

You can create new variable like this [variable] = [value]
Value can be number or string.

Some form of expression evaluation is present. It ignores the order of operations and can't use parentheses. ---this badly needs improvement

if...then statements can use = < > or ! (not equal) for comparison. 'then' has been added since the original posted version and is now required.

lines of code beginning with a line number will be stored to run later.
run the stored code by typing ex.

strings should be enclosed in in quotation marks. this is not yet strictly enforced.

currently supported:
goto [line number]
print [something]
[variable] = [value]
if [expression] [= OR ! OR > OR <] [expression] then

Code: Select all

input [string] [variable]
cls

typing in "save" brings up a file dialog to save your program
"load" allows you to load a properly formatted text file into "memory"
"showstate" shows the list of variable names on one line and values on the second line

Identify parent variables by using parentheses like this: childVar = ([expression])
You do not have the required permissions to view the files attached to this post.